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.

Updating content in place

Updating content in place

From the course: The DOM in JavaScript, jQuery, AngularJS, and React

Start my 1-month free trial

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…

Contents