提交按鈕我有一個簡單的表格,檢查通過對一個可變的用戶輸入密碼後的價值,如何禁用使用jQuery
我試圖禁用提交按鈕,做檢查,並給予警告消息,我無法弄清楚我做錯了什麼,任何幫助將不勝感激。
<form id="post_code">
<input name="textfield" type="text" id="postcode" size="14" maxlength="8" />
<input type="image" id="submit_postcode" src="images/B_go.png" alt="Submit Postcode" width="59" height="24" border="0" />
</form>
$(function() {
$('form#post_code').submit(function() {
var entered_post_code = $('form#post_code input#postcode').val();
var post_code = "CV";
if (entered_post_code == post_code) {
alert("post code is ok");
return true;
}else {
alert("post code is not ok");
return true;
}
return false;
});
});
http://stackoverflow.com/questions/1594952/jquery-disable-enable-submit-button – 2012-12-19 09:05:01