开发者

How to ignore uppercase/lowercase when selecting pathname? JS/Jquery

if (pathname == "/" || pathname == "/default.asp")

in js using jquery library.

I want this to catch "Default.asp" as well as "DeFa开发者_如何转开发ULT.asp" and "default.asp"

halp.


Use the string.toLowerCase() method, this is base javascript, no jQuery needed:

pathname = pathname.toLowerCase();
if (pathname == "/" || pathname == "/default.asp") {
  //case in-sensitive math!
}


I believe this might work:

if (pathname == "/" || pathname.toLowerCase() == "/default.asp")

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜