<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width",
initial-scale=1.9" />
<title>Color flipper</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav>
<div class="nav-center">
<h1>color flipper</h1>
<ul class="nav-links">
<li>
<a href="index.html">simple</a>
</li>
<li>
<a href="hex.html">chfw dfwafaa</a>
</li>
<li>
<a href="sf3">
</a>
</li>
</ul>
</div>
</nav>
<main>
<div class="container">
<h2>background color: <span class="color">#f15025</span></h2>
<button class="btn btn-hero" >clickMeHAHAHA</button>
</div>
</main>
<script src="script.js" type="module"></script>
</body>
</html>
const btnColorGenerate = document.querySelector('.btn btn-hero')
btnColorGenerate.addEventListener('click', function(){
console.log('working');
})
console.log('x');
const colors = ['#845EC2', '#40246D']
function getRandom(){
return Math.random();
}
Hej mam problem z jsem nie wyświetla mi się nic na stronce poza komunikatem w konsoli
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
at script.js:3:18
pomoże ktoś?