jquery submit()不執行


好吧我承認我竟然犯低級錯誤了。。。我懺悔。。。為了提醒自己置頂一個禮拜

 

<form id="form" method="post">
<input  type="text" name="ceshi" value="測試"/><button type="button" id="submit">提交</button>
</form>
<script type="text/javascript">
$(function(){
    $('#submit').click(function(){
        $('#form').submit()
    })
})
</script>

上述代碼看上去貌似沒什么問題,但是點擊查詢按鈕的時候死活不提交表單,按鈕type改為submit表單提交正常。


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.

 

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

 

然后我把id名字改了就執行了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM