html - textbox value cannot be change using javascript -
this question has answer here:
document.getelementbyid("name").value = data;
it shows uncaught typeerror: cannot set property 'value' of null. why happen?
the data have value.
you're receiving error because there doesn't exist element if id of name
when piece of javascript executing.
document.getelementbyid("name")
returning null
since no element found specified id. attempt access property value
of null
, doesn't exist.
what's happening javascript code executing before element exists (move script end of body or inside document ready function, or mis-typed id.
Comments
Post a Comment