Toggle HTML radio button by clicking its label Toggle HTML radio button by clicking its label javascript javascript

Toggle HTML radio button by clicking its label


You can also wrap your elements without giving them each an ID, since a <label> is implicitly for the input it contains, like this:

<label>   <input type="radio" name="mode" value="create">   <i>create table</i></label>


You can use <label> elements, which are designed to do exactly that:

<input type="radio" id="radCreateMode" name="mode" value="create" /><label for="radCreateMode"><i>create table</i></label>


Wrapping the input under the label should work.

<label>    <input type="radio" name="mode" value="create"><i>create table</i></label>