From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Create an event listener

Solution: Create an event listener - JavaScript Tutorial

From the course: JavaScript Essential Training

Solution: Create an event listener

(upbeat instrumental music) - [Instructor] There are several ways of solving this challenge, and if you couldn't make it work with any of the ways you tried that is perfectly okay because this particular challenge is much more advanced and much more complex than the previous ones. I'll show you why before I show you the solution. We're working with a series of forms here, and when the user interacts with any of these forms we need to not only detect which button was clicked but which input field is associated with that button and which external paragraph with a span inside it is associated with that button so that the value that's put in the input field gets passed up into the span with the class value for the associated paragraph. That is not straightforward. The reason I've created this challenge is because this is a fairly common problem you'll encounter on the web, and understanding the logic of how to solve this kind…

Contents