From the course: The DOM in JavaScript, jQuery, AngularJS, and React
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Updating content in place
From the course: The DOM in JavaScript, jQuery, AngularJS, and React
Updating content in place
- [Instructor] In this video, I'm going to show you how to use JavaScript to update content in the DOM tree. So for example, back on this About page, I want to be able to click on any of these images, and then have a little pop-up window pop up somewhere, and allows us to enter new text into that window. Then once you submit the window, it should change some content. I want to change the title for these people, so when I click on, for example, Don Lee's image, I can change the content here. So let's do that using JavaScript. Go back to Brackets. Here in the About page, right here is the team members' names. I'm going to scroll down just a little bit to see Don Lee's information here. What I'm going to do, is I need to attach an event to this image. I will use the onclick event. So we add onclick. When I click this image, it's going to load a function, and we'll call this function just changeName. I'm going to pass this object called this to it, so this points to this image, so it will…
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.
Contents
-
-
-
-
Select elements with getElementById7m 26s
-
(Locked)
Select elements with getElementsByClassName9m 41s
-
(Locked)
Select groups of elements with getElementsByName8m 8s
-
(Locked)
Select elements with getElementsByTagName6m 15s
-
(Locked)
Add, append, and delete DOM nodes13m 43s
-
(Locked)
Updating content in place4m 16s
-
-
-
-
-