문제

I need to validate hidden fields, so I have this below (validate hidden fields)

$.validator.setDefaults({ ignore: [] });

I would like to ignore a certain class as well, but I'm not sure of the syntax to get both.

$.validator.setDefaults({ ignore: "[], .ignoreThisClass" });

This obviously does not work but how can I specify to both validate hidden and ignore my class?

도움이 되었습니까?

해결책

Add your class to the array instead.

$.validator.setDefaults({ ignore: [".ignoreThisClass"] });

It's an array of jquery selectors. If the element matches the selector, it is ignored. By default it is [":hidden"] which is why making it [] makes it allow hidden elements.

다른 팁

$.validator.setDefaults({
ignore: ".ignoreThisClass"
});

Try putting in your .ignoreThisClass class the property.

visibility: hidden;

I believe it will work

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top