How do I access an attribute in an event handler?
<p>Why does the following code produce two different alerts? I'm trying to add the "myAttr" attribute using Jquery, but it's value is not available inside the live click handler. </p>

<pre><code>$("#holder").append("&lt;div class='varInfo' myAttr='1'&gt;new&lt;/div&gt;")
    .attr("myAttr","a1")
    .click(function(){
        alert($(this).attr("myAttr"));
    });

$(".varInfo").live('click',function(){
    alert($(this).attr("myAttr"));
});
</code></pre>
