How can I add a click event to a button and get it to call a function?
<p>I used the following to create a modal window:</p>

<pre><code>function openAdminModal(dObj, content) {
    var modal = $.modal({
        title: dObj.title,
        closeButton: true,
        content: content,
        width: false,
        resizeOnLoad: true,
        buttons: {
            'Submit': function (win) {
                submitHandler(dObj.$link, $('#main-form'), false);
            },
            'Close': function (win) {
                win.closeModal();
            }
        }
    });
}
</code></pre>

<p>I am not sure this helps with the question but I am adding it just in case. </p>

<p>The modal it creates has the following:</p>

<pre><code>&lt;div id="modal" style="display: block;"&gt;
....
    &lt;button type="button"&gt;Submit&lt;/button&gt;
</code></pre>

<p>The button is not inside of a form and the code around the button can't be moved. What I would like to do is to use jQuery to add an event to this button so that when it is clicked the following function is fired. </p>

<pre><code>submitHandler(dObj.$link, $('#main-form'), false);
</code></pre>

<p>Can someone explain to me how I can use jQuery to add the calling of the function to the click event of the button. One thing I am not sure of is HOW can I select that button as it has no ID. The only thing it has is text of "Submit". Can I use the value of the variable modal that's on line 2 of the first code when doing my search?</p>
