jQuery.validate.js onkeyup = true错误 [英] jQuery.validate.js onkeyup = true error

查看:180
本文介绍了jQuery.validate.js onkeyup = true错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用我的jquery验证配置,将onkeyup设置为true时,出现以下错误.如果将其设置为false,它会起作用,但是直到我模糊该字段,我才会收到验证反馈,并且我希望对每个键进行验证:

With my jquery validation configuration, I get the following error when setting onkeyup to true. It works if I set it to false, but I don't get validation feedback until I blur the field, and I'm looking to get validation on each keyup:

$("#signupForm").validate({
        onkeyup: true,        
        onclick: false
        // rules omitted for brevity
    }

我收到以下错误:

TypeError: validator.settings[eventType].call is not a function
validator.settings[eventType].call(validator, this[0], event);
jquery.validate.js line 391

推荐答案

您实际上需要将onkeyup选项设置为接受要验证的元素作为参数的函数,因此请尝试更改:

You actually need to set the onkeyup option to a function that accepts the element being validated as a parameter, so try changing:

onkeyup: true, 

onkeyup: function(element) {$(element).valid()}

这篇关于jQuery.validate.js onkeyup = true错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆