a href click() and closure
<pre><code>var DAYBOOK = {
    22 : 'hmm',
    9 : 'waaaah'
};

function cnstr_submenu(){
    var elm = $('#test');
    for(var key in DAYBOOK){
        (function(key){
            elm.append('&lt;a href="#"&gt;'+DAYBOOK[key]+'&lt;/a&gt;&lt;br&gt;').click(function(){
                alert(key);
            });
        })(key);
    }
};
cnstr_submenu();
</code></pre>

<p><a href="http://jsfiddle.net/9AqVK/" rel="nofollow">http://jsfiddle.net/9AqVK/</a></p>

<p>Why is it that all properties in the DAYBOOK object is alerted when you click a link?</p>
