Jquery loop of click() closure
<p>I have an array called print and am trying to get a seperate click event for each button that has id of the print value. Only my last button seems to work unlike the rest and I've looked through online examples and know this is a closure problem. Help is appreciated. Thanks </p>

<pre><code>for(var i = 0; i &lt; print.length; i++){
            var printer = print[i];
            // Watch this:
           $(document).ready(function(){$('#'+printer).click((function(value) {
                return function() {
                     alert(value);
                };
            })(printer));
        });
    }   
</code></pre>
