i figure the 3rd problem. Here is the solution for those who has the same problem: - use type = reset <button id="resetButton" name="reset" type="reset"> Reset</ button> - and then remove all classes //reset form $('#resetButton').click(function() { $('li').removeClass('error'); $('li').removeClass('highlight'); $('li').removeClass('hovering'); });
Hope it helps... I still haven't find the solution for problem 1 and 2. Please help. I think it's because I am changing the parent ('li') when valid success or valid failed, instead of the element itself. But I don't know how to fix it... On Aug 11, 12:29 am, hendra <hendra.soesa...@gmail.com> wrote: > Hi, > > I have 3 problems I need to solve: > > 1. Validate groups of input fields. I see in the example of tabs, you > can do as follows: > > // validate the other two selects when one changes to update the > whole group > var birthdaySelects = $("#birthdateGroup select").click(function() { > birthdaySelects.not(this).valid(); > }); > > However, mine is not using select, but it is using input text field. > So I modify the code into: > > // validate the other two inputs when one changes to update the whole > group > var birthdayInputs = $("#birthdateGroup input").keyup(function() { > birthdayInputs.not(this).valid(); > }); > > However, it is not working with the input fields. Please help to make > it works. > > 2. Checkbox highlight. I am using a class highlight for all the > errors. I use required checkbox, so at least 1 checkbox must be > checked. If I check the first item, then uncheck, the error message > appear and the error class highlight also successfully displayed. > However, if I check the second or the third (etc) item, then uncheck, > only the error msg appear, the error class doesn't highlight. Here is > my code: > > highlight: function( element, errorClass, validClass ) { > > $(element).parents('li').addClass(errorClass).removeClass > (validClass); > }, > unhighlight: function( element, errorClass, validClass ) { > > $(element).parents('li').removeClass(errorClass).addClass > (validClass); > }, > > 3. Reset function not working. Here is my code: > > var v = $('.myForm').validate({ .... bla... bla ... bla}); > > $('#resetButton').click(function() { > v.resetForm(); > }); > > I figure this is caused by I am using a highlight class (see item 2 > above). > > Please help me to find the solution for this. I am still learning > Jquery, but I do find it very useful. > THanks in advance for all the help.