Exercise 10.9

This commit is contained in:
Karan 2021-11-24 22:59:38 +05:30 committed by GitHub
parent d3a45c8828
commit 013df30370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

23
Chapter 10/Exercise 10.9 Normal file
View File

@ -0,0 +1,23 @@
<!doctype html>
<html>
<head>
<title>JS Tester</title>
</head>
<body>
<div>
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
</div>
<script>
const btns = document.querySelectorAll("button");
btns.forEach((btn)=>{
function output(){
console.log(this.textContent);
}
btn.addEventListener("click",output);
})
</script>
</body>
</html>