Question about forms | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

Question about forms

In one of my new codes is a form. I need to make the input boxes empty after they are filled in and the form is submitted. How can I do that? I have tried a couple things, but they all don’t work. Please help me!

11th Jul 2018, 2:48 PM
_F1_
_F1_ - avatar
4 Answers
+ 9
If you're using HTML and JavaScript, the form has a reset method. function onSubmit() { document.getElementById("myForm").reset(); } Else create a function that sets the text of each field to an empty string.
11th Jul 2018, 3:16 PM
naomi
naomi - avatar
+ 12
naomi Thank you! It worked!
11th Jul 2018, 3:27 PM
_F1_
_F1_ - avatar
+ 12
i also tried it and it works thanks alot
9th Sep 2018, 2:41 PM
/*adams west ⚡⚡⚡🇳🇬*/
/*adams west ⚡⚡⚡🇳🇬*/ - avatar
+ 5
Thanks Naomi for the help.
14th Sep 2018, 7:28 PM
//Fpharbhulourz/>😋😈🤓🇳🇬
//Fpharbhulourz/>😋😈🤓🇳🇬 - avatar