jqModal dialog - only displaying once

Posted by James Inman on Stack Overflow See other posts from Stack Overflow or by James Inman
Published on 2010-05-09T14:38:51Z Indexed on 2010/05/09 14:48 UTC
Read the original article Hit count: 434

Filed under:
|

I've got a jqModal dialog with the following code:

  $(document).ready( function() {

    $('td.item.active').click( function(e) {

      $(this).append( '<div class="new">&nbsp;</div>' );

            $("#jqModal").jqm({
                modal:true, 
                onHide: function(e) { 
                    e.w.hide(); // Hide window
                    e.o.remove(); // Remove overlay
                }
            });

            $('#jqModal').jqmShow();

            $('input#add_session').click( function(e) {
              e.preventDefault();
                $('#jqModal').hide();
                $('.jqmOverlay').remove();
            });

    });

  });

The HTML used is as follows:

 <div id="jqModal" class="jqmWindow">
    <form action="" method="post">

      <ul>

        <li>
          <input id="add_session" name="commit" type="submit" value="Add Session" /> <input type="button" name="close" value="Close" id="close" class="jqmClose" />
        </li>

      </ul>

    </form>
  </div>

When I first click a <td>, the dialog launches without a problem. On the second click (or subsequent), the new class is added to the <div>, but the dialog doesn't launch.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jqmodal