以下脚本将在未聚焦时显示错误消息。我将其更改为 jQuery 4.3 或更高版本,但它没有这样做。我知道我在做一些愚蠢的事情,但找不到。请提供建议。谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation</title>
<script src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script src="jquery.validate.js" type="text/javascript"></script>
<script src="additional-methods.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
var validate = $("#signupForm").validate({
rules: {phone:'phoneUS'},
messages: {phone:'Enter a valid phone number'},
submitHandler: function(form) {alert('submit');}
});
});
</script>
</head>
<body>
<form id="signupForm" method="get" action="">
<label for="phone">phone</label>
<input id="phone" name="phone" />
<input type="submit" value="Submit" class="submit" />
</form>
</body>
</html>