jquery submit()不執行

好吧我認可我居然犯低級錯誤了。。。我懺悔。。。爲了提醒本身置頂一個禮拜javascript

 

<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表單提交正常。java


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.post

 

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

 

而後我把id名字改了就執行了spa

相關文章
相關標籤/搜索