I have a single radio button element (which is passed in via an Observer) and I want to detect if ANY of the radio buttons in it's group are checked. How can I query all the radio buttons on the page in it's group with just the element? Thanks.
on 2008-06-17 00:35
on 2008-06-17 07:22
// all radio input elements that are of the same name ("radioName")
$$('input[type=radio][name='+ radioName +']');
// same as above, but also "checked"
$$('input[type=radio][name='+ radioName +']:checked');
// are any checked?
!!$$('input[type=radio][name='+ radioName +']:checked').length;
// or
$$('input[type=radio][name='+ radioName +']').any(function(el) {
return el.checked;
})
- kangax