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)