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
https://forums.phpfreaks.com/topic/227741-documentgetelementbyid-problem-in-js/
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. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.