Get Selected Radio button value using jQuery

selected radio button

Get Selected Radio button value using jQuery

How to get selected radio button value using jQuery?

To get the value of selected radio button the easiest way is to use jQuery.


<!DOCTYPE html>
	<script src=""></script>
	<h3>Radio button</h3>
	<form id="myForm">
  		<input type="radio" name="radioName" value="First" /> First <br />
  		<input type="radio" name="radioName" value="Second" /> Second <br />
  		<input type="radio" name="radioName" value="Third" /> Third <br />
  		<div id="result"></div>

Here we have to include jquery.js because we are doing this problem with jquery.

jQuery.js :

  1. Code some radio buttons with same name. Specify the value for each radio button.
  2. Div with id result is to show the final result.

jQuery : Method – 1

<script type="text/javascript">
	$('#myForm input').on('change', function() 
	   $('#result').html('<strong>Selected radio button :</strong> '+ $('input[name=radioName]:checked').val()); 

In jQuery either we can do the form input change or directly radio button change. Both are done by change event.

The above example is done by form input change,

  1. $(‘input[name=radioName]:checked’).val() will return the selected radiobutton’s value.
  2. Append the result to $(‘#result’).html().

Method – 2

<script type="text/javascript">
     $('input[name=radioName]').on('change', function() 
         $('#result').html('<strong>Selected radio button :</strong> '+ 

By this method we’ll directly call change event for radio button. To get the result you have to call $(this).val() only.

For other jQuery solutions please visit jQuery

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top