Code The form cannot be submitted when clicking the registration button . Name conflicts may lead to confusing failures. Next, I will introduce the solution. Interested friends can learn about the
code As follows:
<form action ="register.php" method="post"> <p class="loginform_row"> <label>用户名:</label> <input type="text" class="loginform_input" id="name" name="name" /><p id="nameerror"></p> </p> <p class="loginform_row"> <label>密码:</label> <input type="text" class="loginform_input" id="pass" name="pass" /><p id="passerror"></p> </p> <p class="loginform_row"> <label>邮箱:</label> <input type="text" class="loginform_input" id="email" name="email" /><p id="emailerror"></p> </p> <p class="loginform_row"> <input type="button" class="loginform_submit" id="submit" value="注册" />改为<input type="button" class="loginform_submit" id="register" value="注册" /> </p> <p class=" clear "></p> </form> $("#submit").click(function() { $("form").submit(); });
The above code cannot submit the form when clicking the registration button
Reason
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.
Other Notes:
The form and its sub-elements should not use a attribute of the form as the name or id, such as submit , length, or method, will cause conflicts. Name conflicts can lead to confusing failures. For a complete list of rules and to check these issue tags, see DOMLint.
So it’s OK to change the id of the registration button to “register”
The above is the detailed content of Jquery submit() cannot submit the question. For more information, please follow other related articles on the PHP Chinese website!