확인란을 선택하지 않은 경우 제출 버튼을 비활성화하는 데 문제가 있습니다. 그것은 체크 박스를 제외하고 다른 모든 것을 위해 작동합니다.확인란을 선택 취소하면 비활성화 됨
<fieldset>
<input class="disableButton" id="card" type="text" />
<select class="selected-state disableButton" id="month" >
<option value="">Exp. Month</option>
<option value="01">01 - Jan</option>
...
</select>
<select class="selected-state disableButton" id="year" />
<option value="">Exp. Year</option>
<option value="2014">2014</option>
...
</select>
<input class="disableButton" id="cvc" type="text" />
<p>I agree to the <a href="http://nofusstoothbrush.com/terms-conditions/" target="_blank">Terms and Conditions</a> <input id="termsCheck" type="checkbox" checked></p>
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input id="submitCard" class="action-button" type="submit" value="Submit" disabled="disabled" title="Please fill all required fields" />
</fieldset>
$(document).ready(function(){
$('.disableButton').on('keyup change', function(){
if ($('#card').val().length < 10 || $('#cvc').val().length < 3 || $('#month').val() == '' || $('#year').val() == '' || $('#termsCheck').attr('checked') == false){
$('#submitCard').prop('disabled', true);
} else {
$('#submitCard').prop('disabled', false);
}
});
});
사용을 만들었습니다 생각'대신'attr'의 prop' –
나는 이것을'prop'로 변경했지만 동적으로 작동하지 않습니다. 한 번 작동하지만 두 번 클릭해도 아무런 효과가 없습니다. 어떤 아이디어? –