I'm trying to create a timetable site for myself to practice CSS grid and Javascript, I would like to be able to select the 'completed?' section of the timetable and change the div's colour to green. However, I'm having no luck.. so far my code is:
document.getElementsByClassName('tick').onclick = changeBgColor;
function changeBgColor() {
document.getElementsByClassName('tick').style.backgroundColor = "green";
}
<div class="item tick complete1"></div>
<div class="item tick complete2"></div>
<div class="item tick complete3"></div>
<div class="item tick complete4"></div>
<div class="item tick complete5"></div>
<div class="item tick complete6"></div>
<div class="item tick complete7"></div>
Any help would be appreciated!