I have a text box element whose value I am trying to access using document.getElementById(\"id-name\").value
. I find that the call is returning a null instead o
For your code
var mytextvalue = document.getElementById("mytext");
mytextvalue
will contain null
if you have a document.write()
statement before this code. So remove the document.write
statement and you should get a proper text object in the variable mytextvalue
.
This is caused by document.write
changing the document.