How to solve the problem that jquery submit() cannot submit the form

小云云
Release: 2018-01-17 13:19:25
Original
1943 people have browsed it

This article mainly introduces in detail the solution to the problem that jquery submit() cannot submit the form. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.

When I wrote the form submission today, I needed to add a confirmation prompt, so I didn’t use the submit button to submit. Instead, I used jq’s submit(), and then there was a problem


添加

@(Model.annualRate_beginDate?.ToString("yyyy-MM-dd"))

取消

Copy after login


Copy after login

Click the submit button and a confirmation prompt will appear, but after confirmation, there will be no response

But if you change the button type to submit, you can submit again

So I went to jQuery API to find the reason, and I immediately understood when I saw the following text:

Additional Notes:

Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.

It probably means that the form and its sub-elements should not use the attributes of a form as the name or id, such as submit, length, and method, otherwise conflicts will occur. Name conflicts may cause this.

It turns out to bebecause the button id is set to submit

Related recommendations:

How jQuery uses ajaxSubmit() to submit a form instance Detailed explanation

Example introduction to the difference between submit() in JQuery and JS

Overview of the submit() method and onsubmit event application of form elements_Basics Knowledge

The above is the detailed content of How to solve the problem that jquery submit() cannot submit the form. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!