For some reason when I run this code, the console says cannot find properties of add event listener, but the names are correct.
Popup.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Popup</title>
</head>
<body>
<h1>Shell Shockers Dark Mode</h1>
<h2>Settings</h3>
<script src="popup.js"></script>
<input type="button" id="hide" value="Hide Name">
<input type="button" id="show" value="Show Name">
</body>
<style>
:root {
--background: #00001D;
}
body {
width: 250px;
height: 500px;
}
h1,h2 {
color: white;
text-align: center;
}
html {
background: var(--background);
}
</style>
</html>
Popup.js
var hide = document.getElementById('hide');
hide.addEventListener('click', function(){
localStorage['HideName'] = true;
})
var show = document.getElementById('show');
show.addEventListener('click', function(){
localStorage['HideName'] = false;
})
My console here says that they cannot find the properties of null reading add event listener, but I double checked that the properties are correct? I can't seem to figure out why this is happening.
`.
– Titus Dec 27 '22 at 15:57