+ 5
Problem with Event>Function>Else>DOM; Please Help!
Can someone tell me why the DOM won't execute in the else statement of my onchange function? https://code.sololearn.com/WR3NIlB3M6tZ/?ref=app
2 Answers
+ 4
There are two reasons for that,
Firstly, you misspelled the getElementById method as getElementbyId
(case of B should be upper)
Second, there is no method reset() associated with input tag. reset () is a method of form Tag.
Use instead value property as value="";
Finally you have to change the else block with this line,
document.getElementById("signature").value="";
Also you forget to put ; (semicolon) after prompt statement.
+ 2
Thank you everyone! I have gotten the issues fixed now and the code works without a hitch. Feel free to give it a try!