Javascript event handler not firing
<p>I have a form in a modal window using jquery.simpleModal. Since simpleModal clones the contents of the initial div to create the modal dialog, I have to rebind event handlers after the modal dialog is created. My code looks something like this:</p>

<pre><code>function showForm() {

    $('div.contactUs').modal({
        opacity: 80,
        overlayClose: true,
        autoResize: true
    });

    var container = $('.simplemodal-container');
    container.find('li.phone input').mask('(999) 999-9999');
    container.find('li.comments textarea').maxChar(1000, { indicator: 'div.commentLength span' });
    container.find('form').submit(function () {

        try {
            var form = $(this);
            var action = form.attr('action');
            var data = form.serialize();
            $.post(action, data, function (result) {
                form.html(result);
                showForm();
            });
        } catch (e) {
            alert(e);
        }

        return false;
    });

}
</code></pre>

<p>However, if I open the modal dialog, then close it, then open it again, it appears that the form submit handler is not wired (opening the modal dialog a second time and clicking submit results in a full page postback, rather than the ajax handler kicking in). I have verified that the other stuff is getting re-bound (the input mask and max char limit stuff), so why is the submit handler not?</p>
