From the course: The DOM in JavaScript, jQuery, AngularJS, and React
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Selecting content in the DOM
From the course: The DOM in JavaScript, jQuery, AngularJS, and React
Selecting content in the DOM
- [Narrator] In this video, I'm going to show you how to use jQuery to select content in the DOM using the ID and class selectors. So, what I'm going to do is I'm going to add two buttons right below the Our Team heading here. One of the buttons will say "show names." One will say "hide names." It's going to extract the data from these individuals and add it to a text area right below those two buttons. So, that's what we want to do. Let's head over to the Brackets ide and start our coding. Here, I'm using this About Data Zero file. So, let's scroll down to the Our Team heading area. Right there about like 71. I'm going to add two button tags in here. Button, use the ID of "btnShowNames". I want to make it unique, and the text should just say Show Names. Another button, this will be "btnHideNames". And, I'm going to add a text area right below it. So, we're going to dump the data to this text area. ID for this will just be "result". We'll leave this blank. I already have a CSS style…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.