Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • reset() method in javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 418
    Comment on it

    Reset() method:

    It is used to clear all the values entered in a form. This method does not require any parameter and also does not return any value.

    Syntax:

    formObject.reset()

    Example:

    <!DOCTYPE html>
    <html>
    <body>
    <h4>Fill your details</h4>
    <form id="loginForm">
      <p>User name: <input type="text" name="fname"></p>
      <p>Password: <input type="password" name="paswd"></p>
      <input type="button" onclick="resetFunc()" value="Reset form">
    </form>
    
    <script>
    function resetFunc() {
        document.getElementById("loginForm").reset();
    }
    </script>
    
    </body>
    </html>

    In the above example when a user will click on reset form button , resetFunc() will get called and it will clear all the form values entered by the user

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: