views:

1113

answers:

1

I would like to style all of the radio buttons with the same name in a form easily in a nice Prototype or jQuery-style shortcut.

$('billship').select('name:shipType') or something like that.

Does such a shortcut for form field names exist?

+11  A: 

With jQuery:

$('#billship input:radio[name="shipType"]');  
$('input:radio[name="shipType"]', '#billship');

Both are equivalent, but the 2nd one performs slightly better and I personally prefer it.

With Prototype, I believe it would look like this:

$$('#billship input[type="radio"][name="shipType"]');
Paolo Bergantino
Thank you. I'm happy to Cornify this one. :)
Diodeus