我有一个递归菜单,我需要子项来影响父项。在下面的示例中,如果任何一个孩子有“选定”类,如何添加“选定”类?
<ul>
<li class="administration first">
<a href="/administration.aspx"><span>Administration</span></a>
<ul>
<li class="users first selected"><a href="/administration/users.aspx"><span>Users</span></a></li>
<li class="forms last"><a href="/administration/forms.aspx"><span>Forms</span></a></li>
</ul>
<div style="clear: both;"></div>
</li>
<li class="analytics"><a href="/analytics.aspx"><span>Analytics</span></a></li>
<li class="options"><a href="/options.aspx"><span>Options</span></a></li>
<li class="system last"><a href="/system.aspx"><span>System</span></a></li>
</ul>
答案 0 :(得分:4)