我想要能够检查URL是否包含单词“catalogue”。
这是我的尝试...
$(document).ready(function () {
if (window.location.href.indexOf("catalogue"))
{
$("#trail").toggle();
}
});
该网站的URL可能是...
http://site.co.uk/catalogue/
或者http://site.co.uk/catalogue/2/domestic-rainwater.html
但它不起作用。请问有人可以指出我哪里错了吗?
.indexOf()
文档了吗? - nnnnnn