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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -