开发者

Hide control depending on url

开发者 https://www.devze.com 2022-12-21 02:59 出处:网络
My url is of the format http://www.xyz.com/DisplayPost.php?postid=20开发者_运维知识库0 I want to detect if the url has \"postid=250\" in it and hide a div called divOne

My url is of the format http://www.xyz.com/DisplayPost.php?postid=20开发者_运维知识库0

I want to detect if the url has "postid=250" in it and hide a div called divOne

How can I do it using jQuery


The query string is stored in the window.location.search variable, so you can scan that:

/[?&]postid=250(&|$)/.test(window.location.search)


I suspect you might be going about this the hard way. Why not just have the empty, which can be effectively the same thing as invisible, then just let it show when it is populated by the script?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号