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

后端 未结 4 2037
爱一瞬间的悲伤
爱一瞬间的悲伤 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:31

    This worked for me on JQuery 1.11

    $("#userName").keyup(function () {
        if ($(this)[0].validity.valid) {
            // AJAX here
        }
    });
    

提交回复
热议问题