jQuery: How to grab RadioButton selection?

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-03-30T20:57:28Z Indexed on 2010/03/30 21:33 UTC
Read the original article Hit count: 418

Filed under:
|

I need to grab the value of the radiobutton option selected with jQuery. I am using the following code but "str" is undefined in Firebug:

 //handling Feed vs. Ingredient RadioButton
            $('[id$=rdoCheck]').change(function() {
                str = $("input[name='rdoCheck']:checked").val();
                //ingredients
                if (str == "ing")
                { $('[id$="lblDescription"]').text("Ingredient") }
                //finished feed
                else if (str == "ffc")
                { $('[id$="lblDescription"]').text("Finished") }

            });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about radiobutton