jQuey help for a small project

My code: https://codepen.io/TheFST/pen/OJbLdzb

What I’m trying to do is, to set the restart button(in this case, a div) to reload, the page once it is clicked. I used the following code:

$("div > #restart").on("click", () =>
location.reload();
)

but when I do this, the coding in the page breaks. Also I’m trying to remove :hover when the round is equal to 5.

TIA!

you may want to research some more selecots, this mean "select the element with id="restart" which parent is a div", as I see, yo do not have such an element

note, as ids are unique, you can’t go more specific than that, you can just use the id selector

1 Like

Yes, I fixed that. thanks.

1 Like

I figured out the first problem,

$("#restart").on("click", () => {
  location.reload(true);
});

instead of

$("#restart").on("click", () => 
  location.reload(true);
);

which I didn’t understand, because I thought, one line arrow function doesn’t need parenthesis.

But, I’m still trying to figure out, how to remove :hover when round === 5.

you could have a class to remove, instead of img:hover you give a class to the element, and style .myClass:hover and remove the class when you don’t need anymore