如何解决输入字段以设置setCustomValidity?它不起作用:
$('#numberinput').val("").setCustomValidity('The two email addresses must match.');
答案 0 :(得分:18)
使用jQuery
,您可以执行以下操作:
$('#numberinput').get(0).setCustomValidity('The two email addresses must match.');
而不是:
$('#numberinput').val("").setCustomValidity('The two email addresses must match.');