I have set up jQuery validation on a page using jQuery 1.7.1 as follows.
<html>
<head>
<script src="jquery-1.7.1.js" type="text/javascript"></script>
<script src="jquery.validate-1.9.0.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#form1").validate();
});
</script>
</head>
<body>
<form id="form1">
<div>
<p>
<input id="form1input1" name="11" class="required" />
</p>
<p>
<input id="form1input2" name="12" class="required email" />
</p>
<input type="submit" value="Validate form 1">
</div>
</form>
</body>
</html>
The fields are validated on submit of the form, but not on blur/keyup.
If I swap out jQuery 1.7.1 for jQuery 1.3.2 then the plugin works as documented with validations on blur/keyup.
Is this a compatibility issue? I can’t find any bugs/open tickets in the GitHub issue tracker https://github.com/jzaefferer/jquery-validation
With this combination, you must specify the
typeattribute on theinput:Example: http://jsfiddle.net/5au9m/
The plugin author (Jörn Zaefferer) suggests this is actually due to a change that happened in jQuery:
Source: Issue filed on github.