받는 방법 체크 박스 이름이 index 인 배열 인 경우 위의 요소 중 <div>
에있는 사용자 정의 jquery 유효성 검사 메시지 하나만을 가져옵니다. 인덱스가있는 체크 박스의 경우
<div class="error">Error will show here</div>
<input type="checkbox" value="0" name="is_appraisal[0]" class="is_appraisal_f siblingcheckbox" id="is_appraisal_f">
<input type="checkbox" value="0" name="is_appraisal[1]" class="is_appraisal_s siblingcheckbox" id="is_appraisal_s">
나는이 시도하지만 검증이 작동하지만,이 두 checkbox.Any 도움말 아래의 오류 메시지를 제공
$.validator.addMethod("onechecked", function (value, elem, param) {
if ($(".siblingcheckbox:checkbox:checked").length > 0) {
return true;
} else {
return false;
}
}, "Please select any one of the following!");
$.validator.addClassRules("siblingcheckbox", {
onechecked: true
});
작동하지 않습니다?
<label id="email_id-error" class="error" for="email_id">Please enter your Email.</label>
그냥 html로 DOM에서이 라벨을 복사하고 오류 메시지를 제거하고 오류 메시지를 원하는 위치 장소에 넣어 :
당신은주지하시기 바랍니다 수 있습니다 질문과 관련된 예. –
@ShakunChaudhary check ans –
오류가 선택 후 사라집니다. –