I'm trying to use jQuery.Gritter within jQuery.validator's errorPlacement... as to send the form validation error to a fancy little container. seems simple enough. maybe i'm just not familiar enough with OOP.. heh.
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]'. I've done a little bit of searching trying to get the essence out of the 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.['0']' or error.[0] doesnt fly for syntax.
help a noob out.
error
is a dom element try this.
errorPlacement: function(error, element) {
$.gritter.add({
title: 'Whoops!',
text: $(error).text(),
image: '/global/media/formExcl.png',
sticky: false,
time: ''
});
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.