Getting the value of a selected radio button out of a radio group in jQuery

Just a quick tip, I needed to get the value of the selected radio button from a radio group using jQuery. While several custom selectors are available for forms, there isn’t a simple way to do it that I could find. I ended up using a solution that I quite like, and wanted to share.


Have I mentioned that I love jQuery?

Edit: This entry was directly attacked by the robots, and all comments were lost. Please leave one again if you left it earlier, and accept my sincerest of apologies.



Steven Hambleton wrote on

If you wanted to compare a radio button value and do something like show an input text field for one of the radio buttons then you can use this -

$("input:radio[name=referredby]").click(function() {
if ( $(this).val() == 'Other' {
else {
$("#referredby_other").hide("fast");  }