Radio Button Text Selection

Just about everywhere except the web you can select which radio button by clicking on the text associated with the button. The way radio buttons on the web function you usually need to click on the button itself.

With a small addition to our code we can change this behaviour to allow the buttons to be selected from the text as well. Here is an example:

The code for the above form is below with the necessary changes to make the radio buttons selectable from the text shown in bold.

<form name="myform" action="#"><div class="centre">
<label for="r1"><input type="radio" value="1st value" name="myradiobutton" id="r1" />1st</label><br />
<label for="r2"><input type="radio" value="2nd value" name="myradiobutton" id="r2" />2nd</label><br />
<label for="r3"><input type="radio" value="3rd value" name="myradiobutton" id="r3" />3rd</label>


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow