I want to change the background color on an element when I hover on it, but i won’t work!?
$(document).ready(function(){
$(".walkingRoute-container").hover(function(){
$("walkingRoute-container").css("background","#02baff");
});
});
Preciate som help. Thanks!
You forgot the dot before the class name in the selector.
Use
$(this)to target the element that is actually hovered, otherwise you will change the background of all elements with that class. You probably also want a function that removes the background when you leave the element: