Jquery submit()無法提交問題
更新時間:2013年04月21日 15:31:15 作者:
代碼點擊注冊按鈕時無法提交表單,名稱沖突可能會導(dǎo)致混亂的失敗,接下來為大家介紹下解決方法,感興趣的朋友可以了解下
復(fù)制代碼 代碼如下:
<form action="register.php" method="post">
<div class="loginform_row">
<label>用戶名:</label>
<input type="text" class="loginform_input" id="name" name="name" /><div id="nameerror"></div>
</div>
<div class="loginform_row">
<label>密碼:</label>
<input type="text" class="loginform_input" id="pass" name="pass" /><div id="passerror"></div>
</div>
<div class="loginform_row">
<label>郵箱:</label>
<input type="text" class="loginform_input" id="email" name="email" /><div id="emailerror"></div>
</div>
<div class="loginform_row">
<input type="button" class="loginform_submit" id="submit" value="注冊" />改為<input type="button" class="loginform_submit" id="register" value="注冊" />
</div>
<div class="clear"></div>
</form>
$("#submit").click(function() {
$("form").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.
其他注意事項:
表單和其子元素不宜用一個表單的屬性的屬性作為name或id的名稱,如submit, length, or method,是、會產(chǎn)生沖突。名稱沖突可能會導(dǎo)致混亂的失敗。對于一個完整的規(guī)則列表,并檢查這些問題標記,看DOMLint。
所以將注冊按鈕的id改為“register”就OK了
您可能感興趣的文章:
- jQuery使用ajaxSubmit()提交表單示例
- Jquery ajaxsubmit上傳圖片實現(xiàn)代碼
- jquery的ajaxSubmit()異步上傳圖片并保存表單數(shù)據(jù)演示代碼
- jquery ajaxSubmit 異步提交的簡單實現(xiàn)
- 解決jquery submit()提交表單提示:f[s] is not a function
- jquery中使用$(#form).submit()重寫提交表單無效原因分析及解決
- 在jQuery ajax中按鈕button和submit的區(qū)別分析
- JQuery與JS里submit()的區(qū)別示例介紹
- jQuery ajaxSubmit 實現(xiàn)ajax提交表單局部刷新
- jquery submit()不能提交表單的解決方法
相關(guān)文章
JQuery select控件的相關(guān)操作實現(xiàn)代碼
JQuery獲取和設(shè)置Select選項方法匯總?cè)缦?,需要的朋友可以參考?/div> 2012-09-09jquery學習筆記 用jquery實現(xiàn)無刷新登錄
為了防止以后好久不用生疏,在這里記下,供剛開始學習jquery的童鞋們借鑒,我也是剛開始學jquery,有什么寫的不對的地方,還請大家指出錯誤,共同進步。2011-08-08AMD異步模塊定義介紹和Require.js中使用jQuery及jQuery插件的方法
這篇文章主要介紹了AMD異步模塊定義介紹和Require.js中使用jQuery及jQuery插件的方法,需要的朋友可以參考下2014-06-06jQuery實現(xiàn)數(shù)字自動增加或者減少的動畫效果示例
這篇文章主要介紹了jQuery實現(xiàn)數(shù)字自動增加或者減少的動畫效果,涉及jQuery結(jié)合時間函數(shù)動態(tài)設(shè)置元素屬性相關(guān)操作技巧,需要的朋友可以參考下2018-12-12jQuery+php實時獲取及響應(yīng)文本框輸入內(nèi)容的方法
這篇文章主要介紹了jQuery+php實時獲取及響應(yīng)文本框輸入內(nèi)容的方法,涉及jQuery響應(yīng)鍵盤事件及ajax調(diào)用php文件針對輸入內(nèi)容的處理與回調(diào)相關(guān)技巧,非常簡單易懂,需要的朋友可以參考下2016-05-05最新評論