HTML Forms

Radio Button Solution

Jen Kramer

AnnieCannons
HTML Forms

Check out a free preview of the full HTML Forms course

The "Radio Button Solution" Lesson is part of the full, HTML Forms course featured in this preview video. Here's what you'd learn in this lesson:

Jen goes through the solution for the radio buttons exercise.

Preview
Close

Transcript from the "Radio Button Solution" Lesson

[00:00:00]
>> Jen Kramer: So I've gone ahead and coded my solution here. So it's basically the same thing over and over again. You just need the label button wrapping around everything. The input type of radio, the name of UFO type, and then your values may be different. You may have called it Battlestar, you may have called it Viper.

[00:00:16]
Or you may have called it Galactica like I did, it doesn't matter. Whatever you have for the value, that will be just fine. And then finally, for the Borg-style cube, exactly the same thing, the input type of radio, the name of UFO type, and the value of Borg.

[00:00:33]
One of the common problems with radio buttons, and you're definitely going to wanna do, is once you have put all of your radio buttons up onto a webpage, you need to go through and click them all, okay. Click on the labels, click on the buttons, make sure only one thing selects at a time, okay?

[00:00:56]
If you have multiple radio buttons selecting, all of them are selected, or you have two of them selected in a weird way, but the other ones are not selecting, something happened with the value that you have for name. Because the value for name needs to always be the same, okay?

[00:01:17]
So name always has to be ufotype. You have to spell it the same way. Silly computers, they don't do typos. Okay, it's really easy to make a typo. So these are typical things that will break if you're coding a set of radio buttons. So anytime you see more than one selected, it's your name.

[00:01:37]
The name has gotta be the same for all of the radio buttons.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now