0
how to reset values and how to add a switch statement to a function ?
4 Respostas
+ 4
document.getElementById('numb').value = '';
// Keep learning & happy coding :D
+ 3
If you enclose the input and buttons inside a <form></form>, your reset button will work without you writing any code.
You might want to prevent submission when the input is empty.
+ 1
Just use this in your HTML code
<form>
<input placeholder="Insert age here" />
<button> Submit </button>
<input type="reset" />
</form>