Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Listening to Nodes</title>
<style>
div {
border: 1px solid red;
padding: 6px;
min-height: 12px;
}
</style>
</head>
<body>
<main id="main">My ID is "main"!</main>
<br />
<div>
<input id="button" type="button" value="Click Me!"/>
</div>
<br />
<div>
1
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Listening to Nodes</title>
<style>
div {
border: 1px solid red;
padding: 6px;
min-height: 12px;
}
</style>
</head>
<body>
<main id="main">My ID is "main"!</main>
<br />
<div>
2
<input id="button" type="button" value="Click Me!" />
</div>
<br />
<div>
1
<div>
3
2
<div>
4
3
<div>
5
4
<div>5</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="index.js"></script>
</body>
<script type="text/javascript" src="index.js"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
const input = document.getElementById("button");

function addingEventListener() {
input.addEventListener('click', addingEventListener);
alert('I was clicked!');
}

addingEventListener()

Loading