Why isn't this form validating with jquery?
I have a form which is not working. I have simplified it greatly and thrown into a JSBIN :
http://jsbin.com/ifezas/edit#j开发者_JAVA技巧avascript,html
Even in this simple example, nothing validates. What gives?
You haven't specified any rules for how it should validate.
For example, you can add the class required
to your inputs to make them required, or you can specify the rules like this:
$('#yourForm').validate({
rules: { field1: 'required', field3: 'required' }
});
See this for the list of built-in validation methods.
If you are looking to require the inputs.
Add a class of required to them. class='required'
.
精彩评论