I am working in wordpress, I am using jquery to add remove class in body tag.
I want to apply class "home" to homepage and for other pages I want to apply "innerpage" class to body tag.
following is my code.
$(document).ready(function(){
var loc = window.location.href; // returns the full URL
//alert(loc);
if (loc == "http://n.net/")
{
$('body').removeClass('innerpage').addClass('home');
$('.widget-area').removeAttr('style');
}else {
$('body').removeClass('home').addClass('innerpage');
}
});
but it is not working if the url comes like: http://n.net/?=s
loc.indexOf('"http://n.net/"') == 0