jquery - Javascript: Show XML If Word Is In URL -


i'm wanting make changes page. "preview" page in blogger when go preview post. far know there no conditional statement it.

the preview page url looks this: http://mydomain.com/b/post-preview?token=###############

so i'm trying use javascript "hey, if /b/post-preview in url, show hide element".

i have been unsuccessful. attempt(and there others):

     $(document).ready(function() {          if ((window.location.href) === '/b/post-preview') {            $('homepage-slider-section').css('display', 'none');          }      }); 

html:

<div id="tobeornottobe">to or not be, question</div> 

javascript:

$(document).ready(function () {     console.log(window.location.href);     if (window.location.href.indexof('fiddle') !== -1) {         $('#tobeornottobe').css('display', 'none');     } }); 

fiddle


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -