• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to check the radio button using javascript?  RSS feed

 
Sivakumar Janardhanan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody this is sivakumar. i have a small doubt on radio button.

i have add two radio button in my code like this
<html>
<head><title></title>
</head>
<body>
<form action="radiochecking" method="post">
<table width="25%">
<tr>
<td>
Sex
</td>
<td>
<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">Female

</td>
</tr>
</table>
</body>
</html>

if i run this code in my system it is working properly. i mean if i select any one radio button other one is disabled.

Now my question is
1.how do i get the radio button values?
2.how do i write the javascript code for radio button event.

please give me the details answer with code. because i tried many different logic. it did not work well.


by
sivakumar
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66263
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sivakumar janardhanan:
please give me the details answer with code.

No. That's not how JavaRanch works. You write the code, and we'll help you with any problems that you are having with it.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The pieces to the puzzle.

onchange

document.formName.elementName[index]

value

checked

Eric
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!