jQuery Validate Plugin turn off text label globally?
I'm currently using this bit of code to loop through all inputs with a certain class and set the message to an empty string, but was wondering if there's a more elegant way to turn off all "next-to-the-input" error messages. Been through a few tries using combinations of wrapper and container and grouping messages, but the defaults are always there and show messages when those things try to hide them. M开发者_StackOverflowain culprit is inline style of "display: inline" IIRC.
$("input.baseAllocationAmount").each(function(idx, elm){
validationMessages[$(elm).attr("name")] = "";
});
var formValidationOptions = {
wrapper: "span",
messages: validationMessages
});
This does the trick:
jQuery.validator.messages.required = "";
have you tried playing around with some of the plugin's options?
looks like you could use showErrors
, or possibly errorClass
or
errorElement
精彩评论