Rating stars
body, html {
margin: 0;
padding: 0;
background-color: black;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
svg {
fill: #bbbbba;
}
#star1 {
fill: #e2e231;
}
.star-color {
fill: #e2e231;
}
var star1 = document.querySelector("#star1");
var star2 = document.querySelector("#star2");
var star3 = document.querySelector("#star3");
var star4 = document.querySelector("#star4");
var star5 = document.querySelector("#star5");
stars = [star1, star2, star3, star4, star5]
function addStyle(n) {
for (i=1; i {
element.addEventListener('mouseover', function(){
addStyle(index+1);
});
element.addEventListener('click', function(){
addStyle(index+1);
a = index+1;
removeStyle(a);
});
element.addEventListener('mouseout', function(){
removeStyle(a);
});
});