[英]jquery.validator errorPlacement with jquery.gritter
I'm trying to use jQuery.Gritter within jQuery.validator's errorPlacement... as to send the form validation error to a fancy little container.我正在尝试在 jQuery.validator 的 errorPlacement 中使用 jQuery.Gritter... 将表单验证错误发送到一个漂亮的小容器。 seems simple enough.
看起来很简单。 maybe i'm just not familiar enough with OOP.. heh.
也许我只是对 OOP 不够熟悉 .. 呵呵。
errorPlacement: function(error, element) {
$.gritter.add({
title: 'Whoops!',
text: error,
image: '/global/media/formExcl.png',
sticky: false,
time: ''
});
},
So... 'error' is an object... so this is obviously gonna produce '[object Object]'.所以......“错误”是一个 object......所以这显然会产生“[object Object]”。 I've done a little bit of searching trying to get the essence out of the object.
我做了一些搜索,试图从 object 中找出本质。
I tried 'error.toSource()' to produce a breakdown of the object.. hoping to get the property name that holds the error value... but I just get this.. '({0:({}), length:1})'.我尝试使用“error.toSource()”来生成 object 的细分。希望获得包含错误值的属性名称……但我只是得到了这个……'({0:({}), length :1})'。
'error.['0']' or error.[0] '错误。['0']'或错误。[0] doesnt fly for syntax.
不适合语法。
help a noob out.帮助一个菜鸟。
error
is a dom element try this. error
是一个dom元素试试这个。
errorPlacement: function(error, element) {
$.gritter.add({
title: 'Whoops!',
text: $(error).text(),
image: '/global/media/formExcl.png',
sticky: false,
time: ''
});
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.