2

I have question regarding the use of jquery 1.8, jquery validation 1.10 and placeholder 2.0.7 (https://github.com/mathiasbynens/jquery-placeholder). I noticed that any version IE skipped the validation of password fields if the placeholder plugin was used. Does anybody have solution for this?

Sparky
  • 98,165
  • 25
  • 199
  • 285
Arin
  • 632
  • 6
  • 16
  • Please show your code and construct a concise working demo of this problem. – Sparky Jan 31 '13 at 16:26
  • nevermind I found out how to solve it. Just set $("form").validate({ignore:""}); it's because jquery validation skips validating inputs set to display:none. Placeholder plugin set elements to display:none while not focused thats why it didnt validate. if you set ignore to empty string it wont ignore any inputs. It will even validate disabled inputs i guess. – Arin Jan 31 '13 at 18:33
  • Please post that as an answer below and "accept" your answer. This is most beneficial to the community. – Sparky Jan 31 '13 at 18:49

1 Answers1

3

I found out how to solve it.

Just set $("form").validate({ignore:[], ...}); where "form" should be your selector and ... is your options.

The reason for the error is because jquery validation skips validating inputs set to display:none. Placeholder plugin sets password elements to display:none while not focused that is why it passed the validation. If you set ignore to [] it will override the default behavior of jquery validation which is not to validate display:none elements.

Arin
  • 632
  • 6
  • 16
  • [See this answer](http://stackoverflow.com/a/8565769/594235). You may want to update your answer and code accordingly. http://stackoverflow.com/a/8565769/594235 – Sparky Jan 31 '13 at 19:58