I have some JQuery written which is intended so when a user navigates to 'page/2/' in Wordpress, an image appears in the sidebar. It's CSS is set to display:none; initially, then I have JQuery change it to display:block; if that URL string is present. The code I wrote has it backwards... so it does this to every page BUT '/page/2/'.
$(document).ready(function() {
var url = window.location.pathname;
if(url.indexOf('/page/2/')){
$('.sidebarimage').css("display","block");
}});
I always thought if there was no condition set in an If statement, it treats it as true, and anything else as false. Should I put a = 1 or something here? What am I missing?
Many thanks SO