I'm using this jQuery plugin: http://docs.jquery.com/Plugins/Validation/validate and it seems to always put the messages after the input element. is there a way to get them to append to before the element instead of after?
Check errorPlacement:
options for plugin:
$("#myform").validate({
errorPlacement: function(error, element) {
error.insertBefore(element);
}
})
Use errorPlacement to control will allow you to put error message on specific place.
$("#myform").validate({
errorPlacement: function(error, element) {
error.appendTo(element.parent("td").next("td") );
}
});
Here are a few samples of errorPlacement with error options as well
For custom error message and control creation
errorPlacement: function(error, element) {
var elementForm = "", containerError = "";
offset = element.offset();
elementForm = element.attr("name");
containerError = "#" + elementForm + "error";
error.prependTo(containerError);
error.addClass('message');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With