jquery - if url is AllItems.aspx then display none else AllItems.aspx?ID= display block -


the script below doesn't seem work!

what's wrong it?

here try do:

if url allitems.aspx display:none else allitems.aspx?id= display:block

var url = location.pathname;   if (document.url.indexof("allitems.aspx")>= 0)  {   jquery("#logo").css("display","none");   }     else if (document.url.indexof("allitems.aspx?id=")>= 0)  {   jquery("#logo").css("display","block");   } 

the ?xxx part of url can read location.search, code may be:

if (location.search.length <= 1) { // may '?'     $('#logo').hide(); } else {     $('#logo').show(); } 

Comments