helloise Posted February 15, 2011 Share Posted February 15, 2011 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 More sharing options...
jcanker Posted February 18, 2011 Share Posted February 18, 2011 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 https://forums.phpfreaks.com/topic/227741-documentgetelementbyid-problem-in-js/#findComment-1175975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.