开发者

jQuery Validate Plugin turn off text label globally?

开发者 https://www.devze.com 2023-03-05 14:05 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号