jQuery ui checkboxes drive me crazy

Posted by Luca Belluco on Stack Overflow See other posts from Stack Overflow or by Luca Belluco
Published on 2010-05-28T15:27:05Z Indexed on 2010/05/28 15:32 UTC
Read the original article Hit count: 374

Filed under:
|
|
|

Hello,

I'm using a form with checkboxes from jQuery UI and I'm having some problems with them :

here is my code : php

<input type="checkbox" id="check'. $empl->getAttr('id') .'" class="intervenants" /><label for="check'. $empl->getAttr('id') .'">'.$empl->getAttr('nom').'</label>';

javascript

$('.intervenants').each(function() {
    $(this).attr('checked',false);
   });
   for(i = 0; i < data.list_empl.length; i++) {
    $('#check'+data.list_empl[i].id).attr('checked',true);
   }

I want, as you can see, uncheck all the checkboxes, then I look in my array and try to check only the checkboxes existing in my array. The problem is that it doesn't work...

I don't know what doesn't work, I've tried to put alert, to look in html but it looks like it's totall incoherent.

I would really appreciate your help, thanks in advance,

Luca.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ui