如果輸入字段與電子郵件和密碼條件匹配,我將向該字段添加「有效」類。我想啓用一個提交按鈕,如果兩個字段都有一個有效的類,一旦有效的類被添加,它仍然在那裏,即使輸入的輸入被完全刪除。使用jquery輸入字段驗證
要解決這個問題,我必須刪除有效的類或增加計數器時,該字段不爲空。我正在嘗試第二種情況,我正在檢查該類是否存在,以及該字段是否爲空。我沒有收到預期的效果用下面的代碼:爲有一個C.options.currentPage
參考和count
未定義
<input type="email" name="email" placeholder="Email" class="email required valid" id="aim_Email">
<input type="password" name="password" id="aim_Password" placeholder="Password" class="newpassword password required aimError" style="">
$('.required').live('blur', function (value) {
if ($(this).hasClass('valid') && $(this).val()) {
count++;
if (count > 1) {
alert('event fired');
$(".submit").removeClass("disabled");
$(C.options.currentPage).find('input[type="submit"]').removeAttr("disabled");
$('.passwordHint').hide();
}
}
});
您是否看過輸入屬性的html5語法?看到這個http://www.the-art-of-web.com/html/html5-form-validation/ – nikhil