Form Reset in JSP

Source: Internet
Author: User

Resetting a form in jquery is primarily about converting jquery into DOM objects, using the Reset () method , so there are two scenarios:

One: Use Get (0)

$ ("#myform"). Get (0). Reset ();

Two: use [0]

$ ("#myform") [0].reset ();

These two methods are in fact consistent with the principle of use;

But here's one thing to note:

Sometimes when you use both of these methods, the browser

typeerror:$ ("..."). Get (...). Resetisnotafunction

Error, this condition may be the reset button in the form defines an exception;

<form id= "MyForm" action= "method=" POST "> User name: <input name=" name "value=" "><br> Password: <input type = "Password" name= "PSW" ><br> <input type= "Submit" id= "SM" value= "Login" > <br> <input type= "reset "id=" reset "value=" Reset ><br></form>


The reason for this is that the id= "reset" in the deadweight button should be set id= "reset" may overwrite the original "Reset ()" method, so the reset () is undefined.

Since the reset button will appear such a problem, then submit will not also appear such a problem, interested can try it yourself ^ ^


This article is from the "Yinbin" blog, make sure to keep this source http://yinbin99.blog.51cto.com/11392662/1853691

Form Reset in JSP

Related Article

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.