Tôi đang cố gắng sử dụng phương thức form checkValidity().html5 form checkValidity() phương thức không tìm thấy
http://html5test.com/ cho tôi biết rằng trình duyệt của tôi (Chrome) hỗ trợ phương thức checkValidity cấp biểu mẫu.
Tuy nhiên, sử dụng jsfiddle http://jsfiddle.net/LcgnQ/2/ Tôi đã cố gắng html sau và đoạn javascript:
<form id="profileform" name="profileform">
<input type="text" id="firstname" required>
<input type="button" id="testbutton" value="Test">
</form>
$('#testbutton').bind('click',function(){
try{
alert($('#profileform').checkValidity());
}
catch(err){alert('err='+err)};
});
tôi nhận được một lỗi: object has no method checkValidity()
Tôi đang làm gì sai?
Cảm ơn.
Tại đây http://stackoverflow.com/questions/28979662/common-jquery-to-disable-submit-buttons-on-all-forms-after-html5-validation/36391754#36391754 bạn có thể tìm thấy nhiều hơn "chung chung của tôi "và giải pháp hoàn chỉnh. – Petr
bạn có thể thử: 'document.getElementById (" profileform ") checkValidity()' – sept08