显示焦点错误-验证jQuery [英] Showing error off focus - Validation jQuery

查看:84
本文介绍了显示焦点错误-验证jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户从输入框等中单击时,如何显示我的错误?

How could I show my error when the user clicks out of the input box etc?

jQuery(document).ready(function() { 
    //Home Validation
    $("#quote").validate({
        rules:{
            companyName:{
                required: true,
                url: true
            }
        }
    });
etc etc

推荐答案

哇,我花了很长时间才弄清楚.

Wow this took me WAY too long to figure out.

简短的回答:input type="input"应该是input type="text".

然后这将起作用:

$("#quote").validate({
    onfocusout: function(element) {
         $(element).valid();
    },
    rules:{
        companyName:{
            required: true,
            url: true
        }
    }
});

这篇关于显示焦点错误-验证jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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