jquery validate校验效果使用tooltip
来源:互联网 发布:c盘windows system32 编辑:程序博客网 时间:2024/05/22 03:11
1、设置默认校验效果,包括成功和失败
$.validator.setDefaults({ showErrors: function(map, list) { //var focussed = document.activeElement; this.currentElements.removeAttr("title").removeClass("ui-state-highlight"); //处理校验成功的元素的tip(销毁tooltip) var succList = this.successList; $.each(succList,function(){ if ($(this).is(':ui-tooltip')) { $(this).tooltip("destroy"); $(this).removeAttr("title"); } }) //校验错误tooltip提示 $.each(list, function(index, error) { $(error.element).attr("title", error.message).addClass("ui-state-highlight"); $(error.element).tooltip({ items: error.element, content: error.message, effect: "fade", opacity: 0.5, position: {my: "left top", at: "left bottom"} }); $(error.element).tooltip("open"); window.setTimeout(function () { if ($(error.element).is(':ui-tooltip')) { $(error.element).tooltip("close"); } }, 2000); }); }});
2、重置校验(重置表单时)
//重置校验 jQuery.validator.resetValidate = function(validator,fromId){ var $elementList = $("#" + fromId).find("input,textarea,select"); //去除高亮显示 $elementList.removeClass("ui-state-highlight"); $.each($elementList, function() { //销毁tooltip if($(this).is(':ui-tooltip')){$(this).tooltip("destroy");} //去掉title $(this).removeAttr("title"); }) validator.resetForm(); }
阅读全文
0 0
- jquery validate校验效果使用tooltip
- jquery前端校验框架validate使用笔记
- jquery validate不使用submit进行校验
- jquery validate 校验心得
- jQuery validate 校验
- jQuery validate校验
- jQuery校验validate详解
- jquery.validate校验库
- jquery validate表单校验
- jQuery validate 校验
- Jquery validate 前段校验
- jQuery Validate自定义校验
- jQuery中的validate校验
- jquery.validate校验
- [jQuery Validate]前端校验
- jQuery表单校验jquery.validate.js的使用
- jQuery表单校验jquery.validate.js的使用
- JQuery -- Validate, Jquery 表单校验
- Codeforces Round #435 (Div. 2) (思路题)
- 利用java反射机制绕开java的泛型
- JavaEE 和 JavaWeb的区别与联系
- 【互联网金融】阻碍用户注册的竟然是……
- Azure 托管镜像和非托管镜像对比
- jquery validate校验效果使用tooltip
- Timer定时器
- 简单监测服务器的shell脚本
- Android EventBus实战
- 贪心算法总结
- SSH数据库与整合
- libaio简介
- vs2010如何加载ffmpeg windows库进行开发
- Android注解插件Butterknife使用