Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this example, rather than react to the onsubmit of the form, I am actually going to react to an event of an individual form element-- in this case, this check box, that when I check it is activating or turning on another section of the form itself. This is very, very simple to do. Let me show you the general process and a few best practices for doing this. So I am going to jump into my editor. The HTML here is very, very straightforward. The section that has multiple check boxes in it is wrapped in a div with an id of tourSelection.
This is the id of the check box in my HTML. So I'm just saying, when that gets clicked, we will perform this anonymous function. Of course, the click could be either checking it in on or checking it off, so the first check is, what is it? And we don't ask for a value here; I asked for the .checked property of brochures. I don't need to say is it equal to true or is it equal to false, because the.checked property is a Boolean.
So just by putting this in my condition I'm asking, this is true, I don't need to say if true equals true, it's just, is it true? If it is, what I'm going to do is grab the div called tourSelection that contains all the other check boxes, and then--and this is the first time we've seen these properties-- I'm using the .style.display property to drop into basically the CSS of this individual element and change that to block. Now, this is making it visible. This is the default way that it looks.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 92739 Viewers
82 Video lessons · 104201 Viewers
71 Video lessons · 75832 Viewers
56 Video lessons · 107205 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.