do you know how to pre-select a Radio Button in HTML ?

Yes. Set the CHECKED property of the HTML radio button to “checked” in order to make it default to the “selected” state.

For example, the following 3 radio buttons are provided to select the most favorite game, with Super Mario BrosChecked” ie selected by default.

Super Mario Bros

Dangerous Dave

Pacman

Code Snippet

<input checked="checked" name="super-mario-bros" type="radio" value="super-mario-bros" />Super Mario Bros
<input name="dangerous-dave" type="radio" value="dangerous-dave" />Dangerous Dave
<input name="pacman" type="radio" value="pacman" />Pacman

, , {1}

One Response on “do you know how to pre-select a Radio Button in HTML ?”

Trackbacks/Pingbacks

  1. [...] Notice how all the 3 radio button declarations have the same name video-game-console-brand. This declaration will rendered the FORM as shown below, with the Nintendo Wii pre-selected. [...]

Leave a Reply