>
> 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);
>                },
>


Example:

function example(errorClass, validClass){
/*you have to ask if length is equal then */
    if($("input[name*='chkList']").length ==
$("input[name*='chkList']:not(:checked)").length){
        /*show the error class highlight or alerts or your class assigned to
all checkbox */
        /* you can add class without send to the function)
        $("input[name*='chkList']").addClass(errorClass)
>
>         alert("please select at least one option")
   }
   else
   {
      $("input[name*='chkList']").removeClass(errorClass)
   }
}

but , i dont know because use "removeClass" or addClass" without respective
parameters, this not add or remove or fire nothing .

-- 
Atte.
Carlos Becar.

Reply via email to