我有一個子菜單內的另一個子菜單的HTML。我要的是在頁面加載,如果一個子子裏有父切換及其母公司來切換類turnedon,所以含鋰帶班的李開啓都是可見的..jQuery切換父母李?
HTML:
<ul class="NewsSubMenu">
<li class="NewsSubMenuOn" style="margin-left:-1.7px;">
<span style="padding-left:35px; color:White;"> News Archive</span>
<ul class="NewsArchive">
<li class="off">
<a href="#" class="year">2012</a>
<ul class="NewsMonths">
<li class="off">
<a href="#" class="month">March</a>
<ul class="NewsArt">
<li class="turnedon">
News Headline
</li>
</ul>
</li>
<li class="off">
<a href="#" class="month">February</a>
<ul class="NewsArt">
<li>
Title </li>
</ul>
</li>
</ul>
</li>
<li class="off">
<a href="#" class="year">2011</a>
<ul class="NewsMonths">
<li class="off">
<a href="#" class="month">March</a>
<ul class="NewsArt">
<li>
PVC4PIPES
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
CSS:
.NewsSubMenuOn ul li.off ul {
display:none;
}
的jquery:
$(document).ready(function() {
$(".turnedon").parent().parent().toggle();
});
我的jquery不工作?
您是否嘗試過只爲測試而顯示隱藏 – zod 2012-03-21 15:46:02