I am making active link with jQuery like this
$(document).ready(function() {
var url = window.location.href;
$(".main-navigation ul li a").each(function() {
var $this = $(this);
var href = $this.attr("href");
if (url === href) {
$this.css({
'color': '#666666',
'font-weight': 'bold',
}).addClass('active').removeAttr("href").removeAttr("onclick");
}
});
The only problem is here that my a href goes like this /Settings/File?id=333
And url wil be something like this
http://www.example.com/Settings/File?id=333
Then the a href and ulr does not match, how to delete http and example for url and check with a href?