I have an unordered list and i would like to change the background color of each item when that item is selected(items in list are link tags) here is the JQuery code that I have so far.
$("#cat").focusin(function(){
$("#cat").css("background-color", "#1796cf");
});
$("#cat").focusout(function(){
$(this).css("background-color", "#333333");
});
#cat
is set as ID in the html for each item in my list. This works but only works on the first item in the unordered list. Please help me get this to work on every item in my list.
Id should be unique use
class
instead of id