开发者

Reset jQuery Validation (GeekTantra plugin)

开发者 https://www.devze.com 2023-01-25 02:50 出处:网络
Hi guys I\'m using the jQuery Validation plugin by GeekTantra link with some custom variations. I would like to find out if there is a way to reset the error checking by clicking a certain element (i

Hi guys I'm using the jQuery Validation plugin by GeekTantra link with some custom variations.

I would like to find out if there is a way to reset the error checking by clicking a certain element (i.e. a div class="reset" or a tab with a specific class).

I have 2 forms in the same page, but only one showing at any given time (one under each tab). If a user submits Form1 and errors appear, he has an option to try another method by selecting the second tab, which reveals Form2. All working fine so far, but if he clicks again on the first tab, the errors are still showing.

What I would like to achieve is that if you click on any Tab, all validation is completely reset for all forms, so n开发者_StackOverflow社区o more errors are showing and everything related to jQuery validation starts from scratch. Is that possible? Thank you!


In your tab change function you can write following piece of code,

document.forms['a123'].reset();

as well as hide your error divs/spans.

$(".error").hide();
0

精彩评论

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