Reputation: 33056
I have this written in a certain Javascript function.
document.getElementById("textbox").innerHTML = "some text";
This does what you'd expect. However, if I slightly modify it to try to clear the text box like this
document.getElementById("textbox").innerHTML = "";
It doesn't work. Why?
Upvotes: 1
Views: 88
Reputation: 755457
I'm not sure why innerHTML
is working in that particular case but the more appropriate property to use is value
document.getElementById('textbox').value = '';
Upvotes: 3