selector question

selector question


Hi. There's a form that has a bunch of options (say, 30) selectable by
checkboxes or true-false radiobuttons (depending on whether it's on a
legacy or current system). Let's further say I want to build some
jquery to select all these options. There are other checkboxes/
radiobuttons on this form, so I need to narrow it a bit. Each item in
question has an id starting with cbOption. The following logic works
for checkboxes (I'm skipping some bookmarklet wrapper):
$('input:checkbox').each( function() {
if(this.id.substring(0,8) == "cbOption")
this.checked = true;
});
1. What's the simplest way to make this work for radio buttons too? I
am stumped on getting an OR into the selector (ie. input:checkbox|
input:radio doesn't work).
2. Is there a way to also include the cbOption id matching as part of
the selector, or must I have the if-substring line?
Thanks!