views:

117

answers:

3

I'm trying to use a radio button as a click function:

$("input[type=radio]").click(function(){

and I don't just want radio buttons, I want radio buttons with the class 'baby', or I could even do it by name if that's easier, searched google and I can't find anything :(

+4  A: 

How about this :

$("input[type=radio][class=baby]").click(function(){
Canavar
Or perhaps even simpler: input[type=radio].baby
moff
.baby is preferable. [class=baby] won't match class="baby somethingElse"
David Dorward
+1  A: 

You can have multplie selectors

$("input[type=radio]", ".baby").click(function(){}

Here you have nice examples

Luis Melgratti
+1  A: 

Use the first selector to globally pick up your inputs and then filter using a second selector.

$("input[type=radio]").filter(".baby")
CMerat