document.getElementById('MyDiv').getElementsByTagName('input')
would give you all input elements in the div with the ID 'MyDiv'.
There's also getElementsByClassName() which can be used in the same
way to filter by classes.
Once you have your checkboxes filtered out one way or the other,
you'll just need to loop through them and set .checked = true.
Hope that helps.
On 22 Jul 2008, at 17:16, RJ wrote:
>
> I have a scenario where on checking a main checkbox, all the other
> checkboxes should be checked
>
> eg:
> main checkbox: $form->checkbox('main',array('onClick' => 'check()'))
>
> other checkboxes:
>
> $form->checkbox('users',array('id'=> $value['User']['id']))
>
>
> javascript:
> function check()
> {
> if(document.getElementById('main').checked == 1)
> {
> //alert("main is checked");
>
> // check all the other checkboxes
> }
> }
>
>
> My problem is, how to get refrence to the other checkboxes.
>
> any help wld be appreciated.
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---