jQuery if has this in the url remove everything from a div

If you’re on

http://site.com/something/whatever-in-the-url/something-else/

Find, “#this-div” and remove everything in it.

$(function() {
    if ( document.location.href.indexOf('whatever-in-the-url') > -1 ) {
		$('#this-div').remove();
    }
}); 

Leave a Reply

Your email address will not be published. Required fields are marked *

22 + = 23