+ 4

How to clear input field just after hitting submit button?

How to clear input field automatically just after the submit button has clicked?

19th May 2021, 10:49 AM
Jp (Jay )
Jp (Jay ) - avatar
3 Antworten
+ 6
This should work: let inputField = document.getElementById("inputField") let submitBtn = document.getElementById("submitBtn") submitBtn.addEventListener("click", () => { inputField.value = ""; }
19th May 2021, 11:07 AM
Isaac Fernandes
Isaac Fernandes - avatar
+ 3
This works without JS: HTML: <form> <input /> <input type="reset" value="Submit" /> </form>
19th May 2021, 4:14 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
0
Are you use the MySQL ? For database ?
21st May 2021, 10:35 AM
Ismu Ilham Syaiful Amri
Ismu Ilham Syaiful Amri - avatar