![](https://wpdevkit.in/wp-content/themes/twentytwenty-child/imgs/post01.jpg)
Highlight All Links To Current Page
![](https://wpdevkit.in/wp-content/themes/twentytwenty-child/li_st1.png)
![](https://wpdevkit.in/wp-content/themes/twentytwenty-child/li_st1.png)
![](https://wpdevkit.in/wp-content/themes/twentytwenty-child/li_st1.png)
![](https://wpdevkit.in/wp-content/themes/twentytwenty-child/imgs/kand5.png)
This function will add the class “selected” to any links (even relative) that point to the current page.
$(function(){ $("a").each(function(){ if ($(this).attr("href") == window.location.pathname){ $(this).addClass("selected"); } }); });
![](https://wpdevkit.in/wp-content/themes/twentytwenty-child/author.jpg)
POST COMMENTS