How To Reset Form Using jQuery

  Sep 2023
  ITSolutionsGuides
  Category: jQuery
How To Reset Form Using jQuery

Hi Developers,

Lets Start Coding

In this below example we have the form with id Formdata

We are using the function called resetForm() to reset the form using the Javascript DOM. We are triggering the function on button click using onclick="resetForm()" to execute the function.

<html lang="en">
 <head>
 <meta charset="utf-8">
 <title>Rest Form Using jQuery</title>
 </head>
 <body>
  <form id="Formdata">
   <label>First Name:</label>
   <input type="text" name="name">
   <input type="submit" value="submit">
  </form>
  <button type="button" onclick="resetForm();">Reset</button>
 </body>
 <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
 <script>
 function resetForm() {
   document.getElementById("Formdata").reset();
 }
 </script>
</html>

We hope it helps everyone. Thanks for supporting ITSolutionsGuides and keep supporting us also follow us in social media platforms.

Subscribe for NewsLetter

Be the first to know about releases and tutorial news and solutions.

We care about your data in our privacy policy.

ITSolutionsGuides

ITSolutionsGuides was started mainly to provide good and quality web solutions for all the developers. We provide tutorials to support all the developers and also we try to provide solutions to the errors we face while coding.

Contact US

ITSolutionsGuides, provide users with an easy-to-use form to reach out for support or inquiries.

whatsapp  gmail  instagram-new--v1  facebook-circled  twitter-circled  linkedin  github  pinterest 

Copyright © 2023 - 2024 All rights reserved | ITSolutionsGuides