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")
精彩评论