I'm trying to implement the bootstrap active class to my navigation links but currently it's not working with my ordering in rails. The class is supposed to be applied when the clicked link matches the current URL.
This is the URL when the ordering is set
http://localhost:3000/posts?order=hot
But it's not actually applying the active class, as I'm guessing it's the '?' that's breaking it.
var url = window.location;
// Will only work if string in href matches with location
$('.sorting ul li a[href="'+ url +'"]').parent().addClass('active');
This code doesn't seem to be working with the '?'. From this question here