开发者

JQuery IF document url = "../products.html" Then do this

How can I get the document url and compare it with an conditional branch?

Ps开发者_开发百科eudo Code:

If document url = "../products.html"
Then do this piece of code();


If you are working with loaded html, you can try

if(window.location.pathname == "products.html"){
//do something here
}

location.pathname returns the file name or path specified by the location.

In addition, You can get the file name by

var p = window.location.pathname.split("/");
var filename = p[p.length-1];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜