How do I clear my form text fields after submit? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I clear my form text fields after submit?

Can you send to me the code and where to put it? Most websites say the code but not where to place it. I'm using ajax.

11th Mar 2020, 3:26 PM
Fábio Gonçalves
Fábio Gonçalves - avatar
4 Answers
+ 1
use yourFormElement.reset() put it after the request are successful with the desired response
11th Mar 2020, 3:31 PM
Taste
Taste - avatar
0
yourForm must be replaced with my form name right?
11th Mar 2020, 4:31 PM
Fábio Gonçalves
Fábio Gonçalves - avatar
0
yes
11th Mar 2020, 4:32 PM
Taste
Taste - avatar
0
Thank you a lot. Already working.
13th Mar 2020, 8:29 PM
Fábio Gonçalves
Fábio Gonçalves - avatar