Jquery validator reset $.validator.setDefaults({ onfocusout: false, onkeyup: false }); in MVC3

家住魔仙堡 提交于 2019-12-18 07:31:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!