제 양식에 모든 필드가 선택 될 때까지 제출 단추를 사용하지 않으려합니다.필드 유효성 검사시 이상한 jQuery 문제
를 열고이 jsfiddle과 순서로 다음을 수행하십시오 Description
분야에서
- 쓰기 뭔가.
category
을 선택하십시오.
Title
필드가 비어 있으면 제출 버튼이 활성화됩니다. 모두 필드가 채워질 때까지 제출 단추가 비활성화 된 상태로 유지되도록 코드를 변경하려면 어떻게해야합니까?
jQuery 코드 : 당신은 타이틀 입력의 emptyness을 선택해야합니다
jQuery("input[type='text'], textarea").on("keyup", function(){
if(jQuery(this).val() != "" && jQuery("textarea").val() != "" && jQuery("input[name='category']").is(":checked") == true){
jQuery("#subnewtopic").removeAttr("disabled");
} else {
jQuery("#subnewtopic").attr("disabled", "disabled");
}
});
jQuery("input[name='category']").on("change", function(){
if(jQuery(this).val() != "" && jQuery("textarea").val() != "" && jQuery("input[name='category']").is(":checked") == true){
jQuery("#subnewtopic").removeAttr("disabled");
} else {
jQuery("#subnewtopic").attr("disabled", "disabled");
}
});
나는이 질문의 복사본이 아닙니다. http://stackoverflow.com/questions/27829051/enable-submit-button-only-when-all-fields-are-filled with already many 예 : http://jsfiddle.net/jsq7m8hL/2/ 또는 원하는 경우 http://jsfiddle.net/soyn0xag/40/ –