I want my button's class name to show up when I click on it, but nothing is showing up.
const buttons = document.querySelectorAll("button");
buttons.forEach((button) => {
button.addEventListener('click', () => {
console.log(button.className);
})
})
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Rock Papers Scissors</title>
<link rel="stylesheet" href="styles.css" />
<script src="javascript.js"></script>
</head>
<body>
<h1>Rock Paper Scissors</h1>
<button class="rock">Rock</button>
<button class="paper">Paper</button>
<button class="scissors">Scissors</button>
</body>
</html>
I've omitted some of the full code, but you can find it here if required: https://github.com/pranit-garg/odin-rock-papers-scissors
Thanks so much for the help in advance!