quick one, if user clicks text of radio button it selects the button

Joined
12 Feb 2006
Posts
17,639
Location
Surrey
sure this must be an easy one but can't find an solution. im embarrassed to admit i don't know it which is why i tried google but even that isn't providing an answer.

just want it so that when the user clicks the text with a radio button it selects the radio button. would have thought thats what label does but unless i did it wrong i can't get it to.
 
why bother? when people see a radio box, they instinctively go for the radio button itself - not click on the text? :confused:

but it can be done easily enough. give the checkbox an id. wrap the text in a span and set the onclick property of the span to....

Code:
document.getElementById('blah').checked = true;

didn't realise thats the way to do it, thought it was some html that associated the text with the button.

i for one never ever click the radio button, always the text as its a much larger area to click compared to the teeny weeny radio button.
 
Back
Top Bottom