c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
JQuery

How to get selected radio button value using jQuery?

| | ASP-NET , JQuery

In this article, Iwill show you how to know which Radio button selected using JQuery. You can getradio button selected value by group name of radio button using checkedproperty. 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('input').on('change', function () {
                alert($('input[name=Countries]:checked').val());
            });
        });
    </script>
<form id="Form1">
        Select your Country:
         <br />
        <input type="radio" name="Countries" value="India" />
        India
        <br />
        <input type="radio" name="Countries" value="Pakistan" />
        Pakistan
        <br />
        <input type="radio" name="Countries" value="Bangladesh" />
        Bangladesh
        <br />
</form> 

Description: 

In above example, ifthe user selects the Country from the country List you can get the selectedcountry by group name (Countries) using checked property.

Output: