faqts : Computers : Programming : Languages : JavaScript : Forms : Radio buttons

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 14 people (71%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I let a radio button be selected by a click on the textual description before or behind it?

May 2nd, 2002 16:29
Mark Paschal, jsWalter, Martin Honnen,


See also HTML 4's "label" tag:
http://blooberry.com/indexdot/html/tagpages/l/label.htm
===================================
wt - 5/10/01
Also see this FAQ...
  http://www.faqts.com/knowledge_base/view.phtml/aid/6053/fid/201
Walter
===================================
NN6, IE4+ and Opera5 allow to set up an 
  onclick
handler on a
  span
so that an example looks like
<HTML>
<HEAD>
</head>
<BODY>
<FORM NAME="formName">
Select your GOD:
<BR>
<INPUT TYPE="radio" NAME="god">
<SPAN ONCLICK="document.formName.god[0].click()"
      STYLE="cursor: pointer; cursor: hand;"
>
Kibo
</span>
<BR>
<INPUT TYPE="radio" NAME="god">
<SPAN ONCLICK="document.formName.god[1].click()"
      STYLE="cursor: pointer; cursor: hand;"
>
Maho
</span>
<BR>
<INPUT TYPE="radio" NAME="god">
<SPAN ONCLICK="document.formName.god[2].click()"
      STYLE="cursor: pointer; cursor: hand;"
>
Xibo
</span>
</form>
</body>
</html>