The Reset in jquery

Source: Internet
Author: User
The submission form is like this: the Code $ (' #myform '). Submit () $ (' #myform '). Submit () So, take it for granted that resetting the form is, of course, like this: code $ (' #myform '). Reset () $ (' # MyForm '). Reset () However, unfortunately, there will be a depressing result for you, that is, the form cannot be reset! Later, on the Internet to check, that is, jquery did not reset method, after checking, sure enough is not.  Is there no way to reset the form with jquery, the answer is, it's just an indirect approach, as follows: The code $ (' #myform ') [0].reset ()] is the reset form by invoking the Reset method in the DOM. I've already used two types of resets myself: //$ (": Reset") Select all the reset buttons

$ (": Reset"). Click (function () {

  The first: Assign values directly to NULL
$ ("#form1"). Val ("");

Second: Reset the form by calling the Reset method in the DOM
$ ("#form1" [0].reset ();
});

My form:

<form id= "Form1" >

<input Type= "Reset"/>

</form>

The Reset in jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.