I have this
if( window.location.href == "http://localhost:3000/categories") {
$("#container ul #all_categories a.categories-menu").css("font-weight","bold");
}
});
but I have a url with:
http://localhost:3000/username/boards
username is dynamic username e.g.
http://localhost:3000/michael-21/boards
http://localhost:3000/Richard_10/boards
http://localhost:3000/Mary.50/boards
and change for each user.
How can do the same functionality but with this last url?
Thank you
You don’t need a RegEx. The following method is easier, and is also easier to maintain (you don’t have to change the URL in the code when moving the page to the production environment):
The previous would also match
/me/not/boards. If you don’t want that:Finally, the RegEx method:
Implementation example