Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: getElementById

  1. #1
    Senior Member
    Join Date
    Aug 2011
    Posts
    215
    Member #
    29153
    Liked
    3 times

    getElementById

    I have a function that uses getElementById and it has been working great. Now I have a page where I call it more than once on the page. The first one works but the rest don't. What do I need to do to make multiples work on one page?

  2.  

  3. #2
    Junior Member
    Join Date
    Oct 2018
    Posts
    11
    Member #
    60072
    Quote Originally Posted by Glenn View Post
    I have a function that uses getElementById and it has been working great. Now I have a page where I call it more than once on the page. The first one works but the rest don't. What do I need to do to make multiples work on one page?
    Usually the problem you've described is with the Elements ID values..

    e.g.. getElementById('element_A') and getElementById('element_B') refer to elements id="element_A" and id="element_B"

    all of the elements on your page are automatically assigned and element id by order UNLESS you have specified their Element ID, so each element MUST have a unique ID.. Chances are your page has multiple elements specified with the same ID.

    Generally JavaScript uses the elements ID and PHP and POST use the element NAME..

    Generally the convention is to have the Element ID and Name the same but unique to all other elements on your page...

    Hope that helps...


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:25 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com