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 Answer
+ 7
because comment is just a string, not the reference
You have to write:
document...(commentBox).value = "";