+ 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

8th Feb 2018, 8:39 PM
Thomas Slack
Thomas Slack - avatar
2 ответов
+ 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.
8th Feb 2018, 10:59 PM
Rex Terminous
Rex Terminous - avatar
+ 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!
9th Feb 2018, 11:48 PM
Thomas Slack
Thomas Slack - avatar