From the course: JavaScript for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Radio buttons and checkboxes

Radio buttons and checkboxes - JavaScript Tutorial

From the course: JavaScript for Web Designers

Start my 1-month free trial

Radio buttons and checkboxes

- [Instructor] In this video, we're going to look at another pair of form input types: check boxes and radio buttons. They're a little more complicated to deal with than text fields or select boxes because they can be on or off, but also carry a value the way other inputs do. Let's scroll down a little bit so we can see our radio buttons and check boxes of interest. We'll start with the check boxes. I'll check this one and inspect it. So I have a label field here, and then a little check box that goes with it, appears before. So I'm going to copy its ID and we'll switch back over to the JavaScript console and select it using document.getElementById. All right, let's look at its value first, the same way we did with the text fields. We come back with Yes. Okay, let's turn it off and try that again. Same thing. Okay, so this is obviously not working the way we might expect, at first. But the value attribute on this…

Contents