Reputation: 3393
I recently asked a question
how would you apply this jquery
$(".homeimage").wrap("<a href='" + location.protocol + '//' + location.hostname + "'></a>");
only if the url has a pathname for example http://google.com/search
but dont apply the jquery if the url is http:/google.com/
Upvotes: 1
Views: 436
Reputation: 224877
if(window.location.pathname && window.location.pathname !== '/') {
$(".homeimage").wrap("<a href='" + location.protocol + '//' + location.hostname + "'></a>");
}
Upvotes: 1