Passing an array of functions as a parameter
<p>Here's my code:</p>

<pre><code>function test(e, f) {
    for (var i = 0; i &lt; e.length; i++) {
        $('#clickme').append("&lt;button id='op" + i + "'&gt;" + e[i] + "&lt;/button&gt;")
        $('#op' + i).click(function () {
            f[i]();
        })
    }
}


$(function postPunk() {
    var func1 = function () {
        alert('1');
    }
    var func2 = function () {
        alert('2');
    }
    var func3 = function () {
        alert('3');
    }
    test(['Option1', 'Option2', 'Option3'], [func1, func2, func3]);
})
</code></pre>

<p>The click events aren't calling the functions. If I place an alert test in the click event, it fires fine. </p>

<p>Any ideas why this isn't working? It seems to be a problem with passing the array of functions as a parameter. Is there a better way to do this?</p>
