[jQuery] Re: Customize Error Labels

2009-07-23 Thread Rizky
sweet. thx man.. On Jul 23, 1:10 pm, Jules wrote: > This should work instead of going through all labels. > >         $('form').validate({ >             errorPlacement: function(error, element) { >                 $('label[for="' + $(element).attr('id') + > '"]').addClass('error'); >          

[jQuery] Re: Customize Error Labels

2009-07-22 Thread Jules
This should work instead of going through all labels. $('form').validate({ errorPlacement: function(error, element) { $('label[for="' + $(element).attr('id') + '"]').addClass('error'); }); } }); On Jul 23, 4:00 pm, Rizky wr

[jQuery] Re: Customize Error Labels

2009-07-22 Thread Rizky
Ahh, Thx for the reply. I get it now :) But my labels isn't always the previous element before the fields. So I changed it to suit my markup. Like this: $('form').validate({ errorPlacement: function(error, element) { $('label').each(function() { var field_for = $(this).attr('for');

[jQuery] Re: Customize Error Labels

2009-07-22 Thread Jules
Read errorPlacement on validate docs. $(document).ready(function() { $("form").validate({ errorPlacement: function(error, element) { $(element).prev().addClass("error"); } }); }); Input: On Jul 23, 3:03 pm, Rizky wrote: > Hi, > >