I have a function in jquery that returns the full URL. Based on that I assign active classes to the correct ID's. But one case tests if the word "fr" is in it (for the language button). But a lot of pages have names containing "frying".
So each time I go on a "frying" page the function gives the "fr" ID an active class.
Is there any way around it? Full url would be something like: www.example.com/frying/oils or in French: www.example.com/fr/frying/oils
$(function() {
  var loc = window.location.href; // returns the full URL 
    if(/fr/.test(loc)) {
    $('#fr').addClass('active');
    $('#en').removeClass('active');
    $('#nl').removeClass('active');
  }
});
 
     
     
     
    