Im trying to validate an email field dynamically using开发者_C百科 jquery.validate here.
The field i'm speaking about is "Email" ("Registro" form).
Any ideas?
Your script order is reversed, include jQuery before any plugins, like this:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
Also since I don't see any conflicts, I'd go ahead and move to jQuery 1.4 to get the latest benefits.
I failed inside the rule..This works ok:
<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }
});
$().ready(function() {
// validate signup form on keyup and submit
$("#jander").validate({
rules: {
'sfApplyApply[email]': {
required: true,
email: true
}
},
messages: {
'sfApplyApply[email]': "Please enter an email",
}
});
});
</script>
精彩评论