我正在尝试使用表单方法 checkValidity()。
http://html5test.com/告诉我我的浏览器 (Chrome) 支持表单级 checkValidity 方法。
但是,使用 jsfiddle http://jsfiddle.net/LcgnQ/2/我尝试了以下 html 和 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)};
});
我收到一个错误:object has no method checkValidity()
我究竟做错了什么?