양식 유효성 검사가 true 인 경우에만 실행하려는 jQuery 함수가 있습니다.
유효성 검사 및 기타 jQuery가 정상적으로 작동합니다.
문제는 이제 유효성 검사와 다른 기능이 동시에 실행됩니다.
양식 유효성 검사가 true 인 경우에만 다른 기능을 실행하고 싶습니다. 여기 내 스크립트입니다jQuery myform.valid()가 true이면 다른 jQuery 함수가 실행됩니까?
<script>
$(document).ready(function() {
$.validator.addClassRules({
fileName: {
required: true
}
});
$("#myform").validate();
if ($("#myform").valid()) {
$(function() {
$('#myform').submit(function() {
var cboxes = ($('input:checkbox:checked').filter(":checked").length);
var nboxes = ($(":checkbox:not(:checked)").length);
if ((cboxes > 0) && (nboxes > 0)) {
confirm('You have Checked only few locations among the List. \n Are you sure, you do not want to Prescribe from the other locations? ');
} else if (cboxes == 0) {
alert('Please select atleast One Address \n Where you would prefer to prescribe from.');
return false;
}
else {
return true;
}
});
});
}
});
</script>
내가이 작업이 완료 얻을 수있는 방법을 알려 주시기 바랍니다?
코드는 지금까지 무엇을 사용할 수 있나요? 관련 부분을 게시하면 알 수 있습니다. –