0
Why won’t the comment box clear when submit is clicked?
https://code.sololearn.com/WPv3y6p3czzr/?ref=app When I used document.getElementById(‘commentBox’).value = “”; The comment box clears just fine after clicking submit. But when I use var comments = document.getElementById(commentBox).value; comments = “”; It doesn’t work. I thought these two were the same thing. Please help. I’m now sure what it is I’m missing here.
1 Resposta
+ 7
because comment is just a string, not the reference
You have to write:
document...(commentBox).value = "";