Sometimes, we want to toggle HTML radio button by clicking its label.
In this article, we’ll look at how to toggle HTML radio button by clicking its label.
How to toggle HTML radio button by clicking its label?
To toggle HTML radio button by clicking its label, we can put the radio button inside the label.
For instance, we write
<label>
<input type="radio" name="mode" value="create" />
<i>create table</i>
</label>
to put the radio button input inside the label element.
Then we can click on the label to toggle the radio button.
Conclusion
To toggle HTML radio button by clicking its label, we can put the radio button inside the label.