开发者

change the event trigger for only one field

开发者 https://www.devze.com 2023-03-14 21:36 出处:网络
i\'m using this plug in to validate a form http://bassistance.de/jquery-plugins/jquery-plugin-validation/

i'm using this plug in to validate a form http://bassistance.de/jquery-plugins/jquery-plugin-validation/

I've got 3 fields, and the first one is username. I want to check the availability of the username only on focusout (not keyup...) using 'remote'. The rest of the开发者_JS百科 fields validate as usual.

Can I do that? How can change the event trigger for only one field?

thanks!


Try:

$('#yourform').validate({
//...Your existing validation logic...
onfocusout: function(element){
    if($(element).attr('id') == 'usernameID'){
        //add your remote logic somewhere here
        //or just:
        $(element).valid(); 
    }
}

});

0

精彩评论

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