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');
>
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
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');
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,
>
>
4 matches
Mail list logo