Chrome의 간단한 확인란에 대한 양식 유효성 검사에 문제가 있습니다.
$("#index_form").submit(function(event) {
var device = $("select[name=device]").val();
var agree = $("input[name=agree]").checked;
if (device==0) {
$("#device").html(" <b style='color:red'>You must enter a device!</b>");
event.preventDefault();
}
if (!agree) {
alert("You must agree to the terms and conditions!");
event.preventDefault();
}
});
Chrome에서는 alert
선택 여부에 관계없이 메시지가 계속 표시됩니다. Safari에서는 괜찮습니다. Chrome을 재설정하고 두 대의 다른 컴퓨터에서 시도했지만 문제가 계속 발생합니다. 체크 박스는 내부에 table
있다 included
으로 php
기능. select
요소를 포함한 다른 모든 유효성 검사 코드 가 잘 작동합니다. 작업을 계속할 수있는 유일한 방법은 문제를 일으키는 코드 줄을 비활성화하는 것입니다.
checked
jQuery 속성이 아니라 DOM 요소 속성입니다. 따라서 대신 사용하십시오.
var agree = $("input[name=agree]").prop('checked');
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다