Expressjs Add Class To Li Element In Partial August 21, 2024 Post a Comment I have this menu in a partial: Profile $(function() { // put the possible page titles here // they must be in the url also var possible_pages = ['profile', 'test'], path = window.location.pathname, pattern, page, i, len; for (i = 0, len = possible_pages.length; i <= len; i++) { page = possible_pages[i]; pattern = new RegExp(page); if (pattern.test(path)) { $('.submenu .' + page).addClass('selected'); break; } } }); Copy Share Post a Comment for "Expressjs Add Class To Li Element In Partial"
Post a Comment for "Expressjs Add Class To Li Element In Partial"