Radiobutton.checked is not working in Chrome, FireFox and Safari?

Posted by Mahe under JavaScript on 11/19/2012 | Points: 10 | Views : 3670 | Status : [Member] | Replies : 1

Radiobutton.checked is not working in Chrome, FireFox6.x and Safari4.0 ?, but its working in IE 9.0
Please provide any suggession.


Posted by: Sandhyab on: 11/19/2012 [Member] Starter | Points: 25

Hi Mahe,
Once try this code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<script type="text/javascript" language="javascript">
function test() {
var rad = document.getElementById("radio1");
var rad2 = document.getElementById("radio2");
if (rad.checked == false && rad2.checked == false) {
alert("Please Select atleast one option");
<form id="form1" runat="server">
<input type="radio" id="radio1" name="radio1" value="1" />
Value 1
<input type="radio" id="radio2" name="radio1" value="2" />
Value 2
<input type="button" id="btnClick" onclick="test()" value="ClickMe" />

This is validation for radio button if user doesnot select any thing.

Thanks & Regards

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response