jquery submit()不能提交表單的的原因

才智咖 人氣:1.45W

複製程式碼 程式碼如下:

jquery submit()不能提交表單的的原因

使用者名稱:

密碼:

郵箱:

改為

$("#submit")k(function() {

$("form")it();

});

上述程式碼點選註冊按鈕時無法提交表單

原因

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.

其他注意事項:

表單和其子元素不宜用一個表單的屬性的屬性作為name或id的`名稱,如submit, length, or method,是、會產生衝突。名稱衝突可能會導致混亂的失敗。對於一個完整的規則列表,並檢查這些問題標記,看DOMLint。

所以將註冊按鈕的id改為“register”就OK了