I want to reset a form in a JQuery click event function. How to do that ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
At it’s simplest:
$("form-selector-here")[0].reset()but also see: Resetting a multi-stage form with jQueryNote that jQuery isn’t necessary for this at all, as
$(selector)[0]obtains the original DOM element. You could also saydocument.getElementById("myFormId").reset().