var path = window.location.pathname; // Returns path only
var element = jq_menu("#topMenu a[href='" + path + "']");
element.parent().closest('li').addClass('active');
我使用此代碼來選擇活動菜單。如何在選擇器條件中使用低功耗條件在jQuery中
我想href
值轉換爲lowerCase
在第2行
我怎樣才能做到這一點?
'path'是一個字符串,所以...'path.toLowerCase()'O.o – Andreas
你試過了嗎'path.toLowerCase()'? – Rajesh
這並不是合適的問題。如果人們不斷提出這樣的問題,那麼這裏就會有數萬億和數萬億的問題。你沒有使用'toLowerCase()'函數嗎? –