问题
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.
回答1:
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)
来源:https://stackoverflow.com/questions/12293125/jquery-validator-reset-validator-setdefaults-onfocusout-false-onkeyup-fal