How to clear all the input in HTML forms?

HTMLWeb DevelopmentFront End Technology

Using HTML forms, you can easily take user input. The <form> tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc.

The <input> tag, helps you to take user input using the type attribute. To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.

Example

You can try to run the following code to clear all the input in HTML forms −

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <form>
         Student Name:<br>
         <input type="text" name="sname">
         <br>
         Student Subject:<br>
         <input type="text" name="ssubject">
         <br>
         <input type="reset" value="reset">
      </form>
   </body>
</html>
raja
Published on 07-Feb-2018 12:24:27
Advertisements