I'm rather new to Javascript and I can't seem to get a script to run/not run on certain pages.
I have this script on my main page to hide and unhide content:
$(document).ready(function() {
$(".hidden").hide();
$(".show").html("[+]");
$(".show").click(function() {
if (this.className.indexOf('clicked') != -1 ) {
$(this).prev().slideUp(0);
$(this).removeClass('clicked')
$(this).html("[+]");
}
else {
$(this).addClass('clicked')
$(this).prev().slideDown(0);
$(this).html("[–]");
}
});
});
I need some coding like this:
if url contains "/post/" then ignore script else run script
It should be a simple fix. I just can't get it to work. Any suggestions?