jQuery: I'm trying to bind a click action to multiple elements with the same class
<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function() {
    $(".slider_link").each(function(i, elem){
        elem.click(function(){
            $("div#"+elem.attr("tag")).slideUp(300);
        });
    });
});

&lt;/script&gt;
</code></pre>

<p>but after the first one (checked with alert) it breaks saying index.html has no method click... whats up with that?</p>

<p>html:</p>

<pre><code>        &lt;li&gt;&lt;a href="#" tag="home" class="slider_link"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#" tag="calendar" class="slider_link"&gt;Calendar&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#" tag="officers" class="slider_link"&gt;Officers&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#" tag="media" class="slider_link"&gt;Media&lt;/a&gt;&lt;/li&gt;
</code></pre>
