21

Something like this:

enter image description here

Where the user would click on any area of the button and it would select that radio button.

Any suggestions?

As far as I can tell, radio buttons as self closed, and can't wrap around other elements.

Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257

4 Answers4

61

The best way is to just wrap the <input> in its <label>, as clicking a label also has the effect of focusing its associated input:

<label>
    <input name="transfer" type="radio">Bank Deposit
</label>

No javascript required: Demo: http://jsfiddle.net/GTGan/

If you need to style the label text separately, just wrap it in a <span>.

zzzzBov
  • 174,988
  • 54
  • 320
  • 367
Wesley Murch
  • 101,186
  • 37
  • 194
  • 228
3

use Bootstrap, to create buttons around radiobuttons:

<label class="btn btn-lg btn-default">  
    <input type="radio"> Something 
</label>
Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Andrew Rebane
  • 199
  • 3
  • 12
2

Have you tried using the LABEL tag? For accessibility sake we should be using label tags to associate labels to form controls all of the time. Not only does that help tie things together for screen readers, but it also makes the label as well as the control clickable.

You can read a bit more detail and find an example here: http://webaim.org/techniques/forms/screen_reader#labels

ph33nyx
  • 301
  • 2
  • 5
-1

You could use javascript for achieving this effect by giving it an onClick event, or you could just use jQuery in combination with some gui-plugins. I'd prefer this solution for cross-browser compatibility.

chabuya
  • 143
  • 1
  • 3
  • 10