Be Brav3

FCC Challenge 32: Create a Set of Radio Buttons

March 13, 2016

In Free Code Camp Challenge 32 we learn to create selectable radio buttons.

You can use radio buttons for questions where you want the user to only give you one answer.

Radio buttons are a type of input

Each of your radio buttons should be nested within its own label element.

All related radio buttons should have the same name attribute.

Here’s an example of a radio button:

[html]

[/html]

Add a pair of radio buttons to your form. One should have the option of indoor and the other should have the option of outdoor.

The original code is below:

[html]

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
[/html]

The updated code with radio button is below:

[html highlight=”48-49″]

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
[/html]