URL example: www.example.com/services/#service1
My various category elements each have a certain ID, the one I'm locating is #service1. I want to make that category active by adding "active-category" class to it. This is my code.
var hash = window.location.hash;
$(hash).addClass("active-category");
when I do:
alert(hash);
I can see #service1
When I input it into $(hash).addClass('active-category');
The class isn't added to the element when I check in the console.