我想選擇一個具有id屬性的ul。它有li標籤,在li標籤內有錨標籤。當我將鼠標移出時,我希望ul及其中的所有元素都被隱藏起來。如何使用Jquery選擇一個id和一個子標籤?
$('#switch-fighters-results-list').mouseout(function(){
$(this).hide();
});
這裏是標記
<div style="display: block;" id="switch-fighters-results" class="ajax-search-results">
<ul id="switch-fighters-results-list" class="ajax-search-results-list clrFx">
<li onmouseout="removeCurrent(this);" onmouseover="addCurrent(this);" class="">
<a href="/fighter/scott/ferrozzo/56">Scott Ferrozzo</a>
</li>
<li onmouseout="removeCurrent(this);" onmouseover="addCurrent(this);" class="">
<a href="/fighter/scott/bessac/63">Scott Bessac</a>
</li>
<li onmouseout="removeCurrent(this);" onmouseover="addCurrent(this);" class="">
<a href="/fighter/scott/adams/191">Scott Adams</a>
</li>
<li onmouseout="removeCurrent(this);" onmouseover="addCurrent(this);" class="">
<a href="/fighter/scott/junk/362">Scott Junk</a>
</li>
<li onmouseout="removeCurrent(this);" onmouseover="addCurrent(this);" class="">
<a href="/fighter/scott/smith/376">Scott Smith</a>
</li>
<li onmouseout="removeCurrent(this);" onmouseover="addCurrent(this);" class="">
<a href="/fighter/scott/baker/555">Scott Baker</a>
</li>
</ul>
<div id="switch-fighter-more-results">
<a id="switch-fighter-more-results-link">13 more found for <span class="input-string">'scott'</span> »</a>
</div>
</div>
你可以發佈你的標記 – Galen 2011-04-19 15:25:40