---
title: "Get Checked Radiobutton Using JavaScript"  
description: "In this blog I will explain how to create radio button in html and how to get checked radio button value by using java script.  First create simple ra"  
author: "Chris Anderson"  
published: 2011-09-07  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/233/get-checked-radiobutton-using-javascript  
category: "javascript"  
tags: ["javascript"]  
reading_time: 2 minutes  

---

# Get Checked Radiobutton Using JavaScript

In this blog I will [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) how to create [radio button](https://www.mindstick.com/articles/12743/radio-button-in-android) in html and how to get checked radio [button value](https://www.mindstick.com/forum/159726/how-can-i-send-the-radio-button-value-in-php-using-javascript) by using java script.\

First create [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) radio button in HTML:

```
     <table cellspacing="10">        <tr>            <td valign="top">                Select technology:            </td>            <td>                <input type="radio" value="PHP" name="radiodbtn" />PHP                <input type="radio" value="ASP.NET" name="radiodbtn" />ASP.NET                <input type="radio" value="JSP" name="radiodbtn" />JSP                <input type="radio" value="ASP.NET MVC" name="radiodbtn" />ASP.NET MVC
            </td>        </tr>        <tr>            <td colspan="2" align="center">                <input type="button" value="Enter"/>            </td>        </tr>   </table>
```

After creating radio buttons, create a [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) in java script that [check whether](https://www.mindstick.com/forum/157543/write-a-java-program-to-check-whether-a-string-is-a-palindrome) a radio button is checked or not and if a radio button is checked, [alert box](https://www.mindstick.com/articles/12940/how-to-create-message-alert-box-using-jquery) display radio button value and also call that function on the click of button:

```
   function getSelectedRadioButton() {
            var ctr = 0;
            var radioLength = radiodbtn.length;
            for (var i = 0; i < radioLength; i++) {
                if (radiodbtn[i].checked) {
                    alert(radiodbtn[i].value);
                    break;
                }
                ctr++;
            }
            if (ctr == radioLength)
                alert("None of the technologies have been selected:");
        }     
```

<input type="button" value="Enter" [onclick](https://www.mindstick.com/forum/12718/onclick-for-hyperlink)="getSelectedRadioButton()" />

By [reading](https://www.mindstick.com/articles/126273/books-commonly-found-on-college-reading-lists) this blog you can easily learn how to get selected radio button value through java script. Thank you for reading this blog.

---

Original Source: https://www.mindstick.com/blog/233/get-checked-radiobutton-using-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
