English 中文(简体)
我如何选择一个id子和一个孩子的tag子?
原标题:how do I select an id and a child tag with Jquery?

我正试图选择一个有背心的ul。 它有li子,在左侧有 anchor子。 当我空洞的时候,我想要把这ul子及其所有内容隐藏起来。

$( #switch-fighters-results-list ).mouseout(function(){
  $(this).hide();
});

页: 1

<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>
最佳回答

你们是否使用<条码>hover? 我得以使用<代码>hover,mouseout。 没有工作

。 FiddleLink

$( #switch-fighters-results-list ).hover(function(){},function(){
    $( #switch-fighters-results-list ).hide();
});
问题回答
$("#ul[id=id]").find("li").each(function(){
   $(this).mouseout(//do something);
});

从所提供的信息来看,我还要说,如果“巫师-农民名单”是ul的:

$( #switch-fighters-results-list li ).mouseout(function(){
  $(this).hide();
});

希望这一帮助。

我不知道它是否发挥了作用,但我认为,适当的办法是:

$( #switch-fighters-results-list ul ).mouseout(function(){  $(this).hide();});

how do I select an id and a child tag with Jquery?

您将利用这一方法:

$( #switch-fighters-results-list li ).mouseleave(function(){
  $(this).hide();
});

如果“li”是儿童选择者。 通知空间:

However, mouseout is probably not going to do what you expect.

mouseover and mouseout fire every time the mouse cursor hovers over another element, or no longer has a direct "line of sight" to the element for which it fires. mouseenter and mouseleave, on the other hand, fire whenever the mouse leaves the bounding box of the element. Try using mouseleave instead of mouseout.

检查:

<http://jsfiddle.net/FVPxP/3/"rel=“nofollow> http://jsfiddle.net/FVPxP/3/

隐藏整个雕刻的最容易的方法如下:

这一解决办法直接解决了你的问题,并完成了hides/em>。 UL在离去时 s着捆绑箱。

<ul id="switch-fighters-results-list">
    <li><a href="lego.com">Lego.com</a></li>
    <li><a href="lego.com">Lego.com</a></li>
    <li><a href="lego.com">Lego.com</a></li>
    <li><a href="lego.com">Lego.com</a></li>
    <li><a href="lego.com">Lego.com</a></li>
</ul>

$( #switch-fighters-results-list ).mouseleave(function(){
  $(this).hide();
});

此外,在进入ul时,必须让所有儿童再次看到.,这是最直接的办法。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...