errorPlacement的位置问题
做一个前端的验证,使用了JQUERY.Validate 在errorPlacement上纠结了半天:
百度大多数都是一个答案:
errorPlacement: function(error, element) {
if ( element.is(":radio") )
error.appendTo( element.parent().next().next() );
else if ( element.is(":checkbox") )
error.appendTo ( element.next() );
else
error.appendTo( element.parent().next() );
},
都是这种类型的
-----------------------------------------------------------------------------------------------------------------------------
而我出现的情况是 error信息总是出现在input的前面,调了很多次都没有弄好,最后浏览器F12发现 input的float是靠右的而导致这个问题
所以我之前想的是改变它的css
-----------------------------------------------------------------------------------------------------------------------------
最后在stackoverflow上找到了我需要的答案:http://stackoverflow.com/questions/2969381/jquery-validation-plug-in-custom-error-placement#comment3725397_3533250
也更改了一点地方,每个errorplacement都有固定的id,然后在其中生成
var errorPosition = $('#blocks-' + element.attr('id'));
error.appendTo(errorPosition); 对于我的情况能够行得通
API: http://www.runoob.com/jquery/jquery-plugin-validate.html
errorPlacement的位置问题的更多相关文章
- jquery validate 指定错误内容的位置
一.默认的提示 messages: { required: "This field is required.", remote: "Please fix this fie ...
- JQuery Validate验证显示错误提示位置
验证多个Name值相同的元素: $(".send").click(function () { var a = 0; var b = 0; var c = 0; var d = 0; ...
- jQuery.validate errorPlacement
在被验证的控件的后一个元素控制显示 errorPlacement: function(error, element) { element.next().css("color",&q ...
- jQuery validate and groups - how to avoid errorPlacement usage?
本文参照:https://stackoverflow.com/questions/14146893/using-groups-with-jquery-form-validation-how 指定错误提 ...
- jquery.validate,错误信息位置
好长时间没有用jquery.validate.js这个插件了,忘得差不多了.唉,好东西还是要经常拿出来看看的,今天用jquery.validate来做一个小东西,遇到一个问题,就是错误提示信息的位置问 ...
- 设置jQuery validate插件错误提示位置
参照上一篇bootstrap布局注册表单 使用校验插件默认位置显示提示信息,发现错误提示信息换行了,由于增加了提示信息,表单显示高度也增加了,如下 默认提示信息位置代码为 将错误提示设置其显示在右边, ...
- 使用validate进行表单验证时土方法(appendTo)改变error显示的位置
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255) ...
- IE6、7下html标签间存在空白符,导致渲染后占用多余空白位置的原因及解决方法
直接上图:原因:该div包含的内容是靠后台进行print操作,输出的.如果没有输出任何内容,浏览器会默认给该空白区域添加空白符.在IE6.7下,浏览器解析渲染时,会认为空白符也是占位置的,默认其具有字 ...
- 逆天通用水印支持Winform,WPF,Web,WP,Win10。支持位置选择(9个位置 ==》[X])
常用技能:http://www.cnblogs.com/dunitian/p/4822808.html#skill 逆天博客:http://dnt.dkil.net 逆天通用水印扩展篇~新增剪贴板系列 ...
随机推荐
- hdu 5578 Friendship of Frog(multiset的应用)
Problem Description N frogs . Two frogs are friends if they come from the same country. The closest ...
- usb键鼠标驱动分析
一.鼠标 linux下的usb鼠标驱动在/drivers/hid/usbhid/usbmouse.c中实现 1.加载初始化过程 1.1模块入口 module_init(usb_mouse_init); ...
- Effective C++笔记 55条编程法则
1. 视C++为一个语言联邦 C++高效编程守则视状况而变化,取决于你使用C++的哪一部分. 2. 尽量以const,enum.inline替代#define 1) 对于单纯常量,最好以const ...
- Oracle Bills of Material and Engineering Application Program Interface (APIs)
In this Document Goal Solution 1. Sample Notes for BOM APIs 2. Datatypes used in these APIs ...
- JFreeChat
JFreeChart教程(一) 分类: java Component2007-05-31 15:53 39849人阅读 评论(30) 收藏 举报 jfreechartimportdataset图形ap ...
- Response.Redirec方法传递汉字出现乱码
解决方法: //传参数时Response.Redirect("a.aspx?name"+Server.UrlEncode("我的名字")); //接收参数时 S ...
- unity读取Sqlite数据库
using UnityEngine; using System.Collections; using Mono.Data.Sqlite; using System.Data; public enum ...
- Properties文件的XML格式(转)
想必大家都用过*.properties文件,作为配置文件.但是,如果该文件写入了中文,待编译后内容就会成为乱码,使用native命令也好.使用ant执行编码转换也好,多少有点麻烦,与其如此,我们不如直 ...
- SSDT表详解
SSDT(system service dispatch table) 系统服务分派表 SSPT(system service parameter table) 系统服务参数表 #pragma pac ...
- Java提高学习之Object(4)
哈希码 问: hashCode()方法是用来做什么的? 答: hashCode()方法返回给调用者此对象的哈希码(其值由一个hash函数计算得来).这个方法通常用在基于hash的集合类中,像java. ...