Each element in the index.html
file needs to add a click handler.
The handler should print the element’s id
to the console.
As a result, when you press the Click me
button, 4 messages should appear in the console.
But their order should be like this: parent-1
, parent-2
, parent-3
, click-target
.
Use the internal script.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="parent-1">
<div id="parent-2">
<div id="parent-3">
<button id="click-target">Click me</button>
</div>
</div>
</div>
</body>
</html>