Jump to content

document.getElementById problem in JS


helloise

Recommended Posts

i have the code in JS:

if(drop_list.value == "zed-catcher/11")
            {
               input_box.disabled=false;
               var catcher_id = document.getElementById('lpm_service_catcher_id');
               catcher_id.value = 11;
            }
            else
               input_box.disabled=true;

how come the line catcher_id.value = 11; is not setting the value to 11????

i get that catcher_id = null????

 

pleas help

thanks

Link to comment
Share on other sites

Have you verified that the dom element does actually exist? 

 

If it was created on the fly, did you actually attach it to the dom using insertbefore or a similar action? 

 

And have you checked the actual value of drop_list.value?  Alert it out and make sure you're actually entering the loop. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.