Binding elements when modal window loads from AJAX (jQuery)

Posted by thinkswan on Stack Overflow See other posts from Stack Overflow or by thinkswan
Published on 2010-03-30T07:27:14Z Indexed on 2010/03/30 7:33 UTC
Read the original article Hit count: 510

Filed under:
|
|
|

I'd like to set up a drag'n'drop list inside a modal window. The window's content is loaded via an AJAX call, so I believe I need to use jQuery's .live() method.

Here is my current code:

$('#cboxLoadedContent').live('load', function() {
    // Event for sortable page lists
    $('ul#pageList').sortable();
});

How can I set up bindings when the modal window loads? The modal window comes from the colorbox plugin.

Note: I'm guessing that 'load' is not the right event to use, because if I throw a simple alert() in there, it doesn't even show up when the window loads.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery