編輯:新增UL類如何添加類H4標籤,它是在第二李 - jQuery的
<ul class="expand-coll-list">
<li>
<h4 class="title-exp-coll title-expand">
<span class="exp-coll"></span>Bookmarks</h4>
<div class="item-list">
<ul>
<li class="first"><div>first Asset</div></li>
<li><div>Latest Updates</div></li>
<li><div>asset image</div></li>
<li><div>test Asset 1</div></li>
</ul></div>
</li>
<li>
<h4 class="title-exp-coll title-expand">
<span class="exp-coll"></span>Menu</h4>
<p>No menu.</p>
</li>
</ul>
例如,如果我加載內容/第1頁
我需要刪除類TITL -expand並在H4標籤這是第一李加級冠軍崩潰
例如,如果我加載內容/第2頁
我需要做同樣的功能在H4標籤,它是在第二李第1頁
我的代碼:
這對於第一種情況下工作,但不爲第二...
if(arg[1] == 'content' && arg[2] == 'page1') {
$(".expand-coll-list li:first").children("h4").removeClass("title-collapse").addClass("title-expand");
} else if(arg[1] == 'content' && arg[2] == 'page2') {
$(".expand-coll-list li:eq(1)").children("h4").removeClass("title-collapse").addClass("title-expand");
}
它有什麼問題嗎?
在此先感謝..
我沒有看到你把.expand-coll-list放在你html的任何地方?是你所有的HTML? – 2012-01-28 07:14:06
@@ Benny:請看現在。添加ul類 – Fero 2012-01-28 07:30:06