开发者

Hide control depending on url

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜