[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 720
  • Last Modified:

Disable radio buttons / onChange event

Hello,

I have two radio buttons called "radiobuttons". The one has as value "number1" and the other one has as value "number2".

How can I disable then using javascript by using an onChange event?

0
Tagor
Asked:
Tagor
  • 3
  • 2
2 Solutions
 
archrajanCommented:
<input type = "radio" name = "radio1" onclick = "javascript: this.disabled = true">
0
 
archrajanCommented:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<input type = "radio" name = "radio1" onchange= "javascript: this.disabled = true">NUMBER 1
<input type = "radio" name = "radio1" onchange = "javascript: this.disabled = true">NUMBER2
</BODY>
</HTML>
0
 
archrajanCommented:
use onclick or onchange whichever will suit ur requirement..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
knightEknightCommented:
more generically:

document.formName.radioName[1].disabled=true;

where 1 in this case represents the second radio button.  (0 is the first, 2 is the third, etc)
0
 
knightEknightCommented:
... meaning, if there is more than one radio with the same name, then use the index number as I described above.
0
 
TagorAuthor Commented:
Thanks guys!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now