So I have a red circle in my html called redq and whenever I click on it, it should change the picture to same picture but in red, I prepared this in Photoshop so all I need to do is change the source. But I can't seem to get it working.
The console in Chrome says "Uncaught TypeError: Cannot set property 'src' of null"
let red = document.getElementById('redq');
const editRed = () => {
let img = document.getElementById('picture');
red.onclick = img.src = 'https://via.placeholder.com/125';
}
editRed();
<header>
<h1 class="header__title">Customize your laptop case</h1>
</header>
<div class="container">
<article class="hoesje">
<h2 class="hidden">Display Picture</h2>
<img id="picture" src="https://placekitten.com/125/125" alt="Laptop case">
</article>
<article class="colorselect">
<h2 class="hidden">Choose a color</h2>
<div id="redq" class="circle"></div>
</article>
</div>