开发者

Remote attribute validation on blur in asp.net mvc 3

开发者 https://www.devze.com 2023-03-29 09:07 出处:网络
The bu开发者_如何学Pythonild in remote attribute in asp.net mvc 3 does the validation \"onchange\".

The bu开发者_如何学Pythonild in remote attribute in asp.net mvc 3 does the validation "onchange".

I want it to validate on blur, is there a way to custom it? or there is something else for doing so? I'm sure it's a very common need.


You could set default values like this and disable validation when a key is pressed:

$.validator.setDefaults({ onkeyup: false });


Assuming you are using jQuery validation and not MS Ajax Validation in ASP.NET MVC 3, you would turn off onchange validation (technically its onKeyUp validation) by using this:

$(".selector").validate({
   onkeyup: false
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号