javascript - Hide a div based on the URL -


Whenever a specific url goes on, I am trying to hide a div.

Something like this: var url = document.location.href; If (url.indexOf ('http: //nonorperfect.local/asp/loginfull.asp')> = 0) {$ ('# hidebox'). Hide (); } And {$ ('# Hide'). Show (); } Write ("& lt; div id = \" hidebox \ "& gt; \ n"); Write ("& lt; p & gt; test ; \ n"); Write ("& lt; / div> \ n");

Run your code after page load and element is available for jQuery to hide is . Convert the URL to lower case and compare the user type in the missile case.

  $ (function () {var url = document.location.href; if (url.toLowerCase) IndexOf ('http: //onorperfect.local/asp/loginfull.asp') & Gt; = 0) {$ ('# hidebox') Hide ();} and {$ ('# Hide'). Show () ;}});    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -