1

I have read this question and I am having the same problem:
Put text input inside label for radio button?

Feel free to take a look using Firefox (Chrome and IE8 do not have this problem.):
http://pastehtml.com/view/1dbqqb3.html

I now understand some javascript has to be used to fix this behavior in Firefox.

But I have no idea how to write this piece of codes.

Thanks in advance.

Community
  • 1
  • 1
bobo
  • 8,439
  • 11
  • 57
  • 81
  • 1
    As noted in the related question... nesting an input element inside the label for another input control isn't supported in HTML. – scunliffe Feb 21 '11 at 03:18

1 Answers1

1

Some html:

<input id="radio1" type="radio" />
<input id="text1" onfocus="selectRadioBtn('radio1')" />

The JavaScript:

function selectRadioBtn(id)
{
    document.getElementById(id).checked = true;
}
gilly3
  • 87,962
  • 25
  • 144
  • 176