Using delegate() with hover()?
<p>I have a ul element with many li items:</p>

<pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;/li&gt;
    ...
&lt;/ul&gt;
</code></pre>

<p>when the user hovers their mouse over an li element, I'd like show some hidden buttons on the li, when they stop hovering, hide the buttons again. Trying to use delegate:</p>

<pre><code>$("#myList").delegate("li", "hover", function () {
    if (iAmHovered()) {
        showButtons();
    } else {
        hideButtons();
    }
});
</code></pre>

<p>the above gets called for both hover and 'un-hover'. How can I distinguish if it's a leave or enter though?</p>

<p>Also, I got this sample from this question:
<a href="http://stackoverflow.com/questions/2591885/delegate-equivalent-of-an-existing-hover-method-in-jquery-1-4-2">http://stackoverflow.com/questions/2591885/delegate-equivalent-of-an-existing-hover-method-in-jquery-1-4-2</a> </p>

<p>in which Nick says:</p>

<blockquote>
  <p>This depends on [#myList] not getting replaced via AJAX or otherwise though, since that's where the event handler lives.</p>
</blockquote>

<p>I do replace the contents of #myList though, using:</p>

<pre><code>$("#myList").empty();
</code></pre>

<p>will that cause a problem?</p>

<p>Thanks</p>
