내 HTML에 필드가 있고 특정 유효성 검사 규칙에 대한 크기 및 값을 확인하려고합니다. 블록, 그것은 사용자가 적절하게 정보를 완료하는 경우에도 붙어 계속하는 경우는의에 들어갔을 때,텍스트 영역의 JQuery onkey up 기능
$(function(){
$('#id_title').keyup(function() {
data = $(this).val();
if (data == " ") {
$('#output').text("The title can not be spaces");
$('#SubmitAction').attr("disabled", true);
} else {
if (data.length < 5) {
$('#output').text("The title can not be shorter than 5 characters");
$('#SubmitAction').attr("disabled", true);
} else {
if (data.length > 30) {
$('#output').text("The title can not exceed 30 characters");
$('#SubmitAction').attr("disabled", true);
}
}
}
data = $(this).val();
});
});
건은 다음과 같습니다 다음은 jQuery 코드입니다.
제목 입력이 5 자 미만이고 #SubmitAction이 사용 중지 된 경우 ... 코드의 아무 것도 활성화되지 않음으로 다시 변경됩니다. –