Próbuję użyć metody checkValidity().html5 formularz checkValidity() Metoda nie została znaleziona
http://html5test.com/ informuje, że moja przeglądarka (Chrome) obsługuje metodę checkValidity na poziomie formularza.
Jednak użycie jsfiddle http://jsfiddle.net/LcgnQ/2/ Próbowałem następujące fragmenty kodu HTML i 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)};
});
Dostaję błąd: object has no method checkValidity()
Co robię źle?
Dzięki.
Tutaj http://stackoverflow.com/questions/28979662/common-jquery-to-disable-submit-buttons-on-forms-after-html5-validation/36391754#36391754 możesz znaleźć moje bardziej ogólne "i kompletne rozwiązanie. – Petr
możesz spróbować: 'document.getElementById (" profil "). CheckValidity()' – sept08