0

are there any way to reset $.validator.setDefaults({ onfocusout: false, onkeyup: false }); in MVC3. I want to change the value in to some thing like $.validator.setDefaults({ onfocusout: true, onkeyup: true }); after I click a button. How to archive this? Thanks.

Sparky
  • 98,165
  • 25
  • 199
  • 285
ChinhPLQ
  • 33
  • 1
  • 8

1 Answers1

0

setDefaults should be set before $('form').validate() is called. Once validate() is called, the default are not used, so you must update the instance settings:

var settings = $('form').validate().settings;
settings.onkeyup = ...

(answer by bruce:link answer)

will-hart
  • 3,742
  • 2
  • 38
  • 48
ChinhPLQ
  • 33
  • 1
  • 8