Hi
I have some jQuery code which will make the “News” menu item appear active on posts from the news category:
jQuery(document).ready(function($) {
console.log($('article').hasClass('category-news'));
if($('article').hasClass('category-news')) {
$('ul#menu-main-menu').find('li#menu-item-2582').addClass('active');
}
});
It works in JSFiddle https://jsfiddle.net/3wyje77q/4/ but I have no idea how to bring it into X.
I have tried to save it into the customiser but that didn’t work. What’s the correct way to add jQuery? Do I need to add the library or is it already loaded?
Thanks