Execute a method passed as parameter to jquery function
<p>I am very new to jQuery world, sorry if this is too basic a question. I have a jQuery function to create button dynamically:</p>

<pre><code>function createButton(element, id, caption, leftPosition) {
    if (element == null || element.length &lt; 1) return;

    var buttonTable = $("&lt;table id='" + id + "'&gt;");    
    buttonTable.addClass("togglebtn");
    buttonTable.css("left", left);

    var trow = $("&lt;tr&gt;");
    $("&lt;td&gt;")
        .text(cellText)
        .data("buttonname", caption)
        .click(function () {
            //alert("Clicked Col=" + $(this).data("buttonname"));
            TestButtonClick();
        })
        .appendTo(trow);
    trow.appendTo(buttonTable);
    buttonTable.appendTo(element);
}
</code></pre>

<p>Since this is a general method to create buttons, I want to add a click event to it so that the calling program can execute it's own method on click event. I mean I want to pass the client method name as parameter to createButton method which should eventually execute it on click. How is it possible to do and how to call the createButton method with that parameter? </p>
