How can I know which radio button is selected via jQuery?

Table of Contents


To determine the value of the Select  radioName of a form with the id  myForm:

$('input[name=radioName]:checked', '#myForm').val()

Here’s an example.

$('#myForm input').on('change', function() {
   alert($('input[name=radioName]:checked', '#myForm').val()); 
<script src=""></script>
<form id="myForm">
  <input type="radio" name="radioName" value="1" /> 1 <br />
  <input type="radio" name="radioName" value="2" /> 2 <br />
  <input type="radio" name="radioName" value="3" /> 3 <br />

This is how you can use it

$("#myform input[type='radio']:checked").val();

For example, if you already have a radio button group reference:

var myRadio = $("input[name=myRadio]");

 filter()  is better than  find().  filter()  searches for top-level elements within your selection, while  find() can be used to locate child/descendant element. ()

var checkedValue = myRadio.filter(":checked").val();

Notes: This was an original answer to a question that suggested using  find(). It seems to have been updated. If you have a reference to a container elements but not to radio buttons,  find() might still be useful. This is:

var form = $("#mainForm");
var checkedValue = form.find("input[name=myRadio]:checked").val();


How Lack of Rest Can Impact Your Finances Small Businesses Can Enhance File Management Following these Tips How Much Do Real Estate Agents Spend on Marketing? How to Engage Your Online Audience for Long-Lasting Success Why is Plagiarism Such a Big Deal? Resume Service Review: Why Everyone Should Use It