Good day. I wrote such code, but I am sure that it was written far from perfect. Can you please tell how to cut it?
$("#text-chords a").on("mouseover", function(){ var hoverChord = $(this).html(), activeChord = $(".tab_chords [data-chord-tab='"+ hoverChord +"']"); activeChord.css("border-color", "red"); //Навел мышь - такой цвет }); $("#text-chords a").on("mouseout", function(){ var hoverChord = $(this).html(), activeChord = $(".tab_chords [data-chord-tab='"+ hoverChord +"']"); activeChord.css("border-color", "#ddd"); //Убрал мышь - такой цвет });
cssgenerally highlight when the cursor on the element can be done on pure css .. and will work faster - Volodymyr