jQuery Validation plugin: how to check if an element is valid?

后端 未结 4 2021
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-15 06:15

A little bit of context:

I\'m using the jQuery Validation plugin to validate a sign-up form. I now want to implement an ajax call to check whether t

4条回答
  •  离开以前
    2020-12-15 06:54

    $("#userName").keyup(function () {
        if ($("#userName").valid() == true ) {
            //make ajax called
        }
    });
    

    http://docs.jquery.com/Plugins/Validation/valid

    Note: To those who do not click the link. You have to call $("#myform").validate(); first.

提交回复
热议问题