url에 단어 카탈로그가 포함되어 있는지 확인할 수 있기를 원합니다. 등jquery url에 단어가 포함되어 있는지 확인하는 방법은 무엇입니까?
이 내가 노력하고 무엇을 ...
$(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
그러나 그것은 효과가 없습니다. 누군가 내가 잘못 가고있는 것을 지적 할 수 있습니까?
if (window.location.href.indexOf ("catalog")) if (window.location.href.indexOf ("catalog")> -1) – rt2800
http://stackoverflow.com/questions/897903/if-a-word-if-window-location-href에 있습니다. – Richard
['.indexOf()'문서] (https://developer.mozilla.org/en/JavaScript)를 사용해 보셨습니까?/Reference/Global_Objects/String/indexOf)? – nnnnnn