User42
User42

Reputation: 100

Jquery form Validate not visible field

I have a Form on 2 separate <div>, with a display none/block mechanism. The submit button is in another <div>.

In the first <div> only, some fields are with the statement required, so when I try to validate the form when the first <div> is displayed, I've got $('#form').valid() = false. But when the first <div> is in display none state and I'm trying to validate the form, I've got $('#form').valid() = true

I have tried to pass some params on the valid() function : $('#form').valid({ignore: ""}) but always the same result.

Upvotes: 0

Views: 105

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You need to pass the ignore option to the validate() plugin initialization call, not to the valid() method

$('#form').validate({ignore: ""})

Upvotes: 2

Related Questions