Q:

jQuery validation live

I have a form that is generated when a user clicks a button, and is put in a dialog div.  Im trying to use the validation plugin, but having trouble attaching it to newly created elements.  With the code below it works but one has to press the submit button twice.  Any help fixing this problem is highly appreciated.  Looked around here but could not find a good answer. 
$('form').live('submit', function(e) {
    $(this).validate({
        rules: {
            presentation: { maxlength: 5000 }
        },submitHandler: function(form) {
            data = $(form).serialize();
            $.post($(form).attr('action'), data, function(res) {
                if (res) {
                    $('p.presentation').html(res);
                }
            });
        }
    });
    e.preventDefault();
});

Thanks in advance
George

A:

Try running the $('form').validate() setup code again right after the form is generated ("when a user clicks a button") rather than on the form submit event.