Jquery/js submit () The problem cannot be submitted

Source: Internet
Author: User

A friend may directly use JS or jquery to submit data instead of using the form to submit directly, small to introduce you to the small part of the problem is that submit () can not be submitted, the following we look at the solution and reason analysis.

jquery cannot be submitted

The code is as follows Copy Code

<form action= "register.php" method= "POST" >

<label> Email:</label>
<input type= "text" class= "loginform_input" id= "email" name= "email"/><div id= "Emailerror" ></div>


<input type= "button" class= "Loginform_submit" id= "Submit" value= "register"/>

</form>

<script>

$ ("#submit"). Click (function () {
$ ("form"). Submit ();
});

</script>

When I submit to find that the hair is not properly submitted, and then use the FF browser to check the error when I found that we have a id= "submit", so that the solution is out of the way we put

The code is as follows Copy Code


<input type= "button" class= "Loginform_submit" id= "Submit" value= "register"/>

Switch

<input type= "button" class= "Loginform_submit" id= "register" value= "register"/>

Again to submit the registration can be submitted, below to introduce a friend to use JS also touched the same problem

, you need to use JS to submit form form. Found using Document.form1.submit (); Method failed to submit form. Firefox hints that submit is not a function. Finally find the solution.

1. There is no name= "submit" label in the form----that's my problem.

2

The code is as follows Copy Code
. <form action= "expat_search.php" name= "Expat_search" id= "Expat_search" method= "post" enctype= "multipart/ Form-data ";

The enctype= "Multipart/form-data" is not missing from the form.

3. When using JS for form verification: JS Verification script can be placed in two places 1) placed in the form header label.
2) put in

The code is as follows Copy Code
<input type= ' Submit ' onsubmit= ' Js_code () '/>

, 3) put in

The code is as follows Copy Code
<input type= ' buttom ' onclick= ' js_code () '/>

This is summarized below if you use 2) or 3) label mode. Must submit = ' onsubmit ', buttom=> ' onclick ' into the use of the wrong can not be changed. such as <input type= ' submit ' onclick= ' Js_code () '/> This is wrong.

Original address: http://www.php100.com/html/program/jquery/2013/0905/5935.html

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.