HTML.form.guide

html5 radio button

How to Add a Label to HTML Radio Button

Radio button allows user to choose only one of the pre-defined options. Each radio button must be accompanied by a label describing the choice it represents. There are two ways to label radio button elements. One is to enclose the whole <input type="radio"> tag inside <label> </label> tags: <label> <input type="radio" name="choice" value="HTML" /> Learn HTML </label> <label> <input type="radio" name="choice" value="Java" /> Learn JavaScript </label> Another alternative is to provide an ID for each radio element and then use that ID in the for attribute of the label.

Continue Reading →