JQuery: How do you use live with the post function

Posted by Luke101 on Stack Overflow See other posts from Stack Overflow or by Luke101
Published on 2010-05-02T18:59:05Z Indexed on 2010/05/02 19:08 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

When load the new html from a post function I lose all of my click bindings. I read that i could use live to keep all the bindings but can't find any examples where live is used with post. Here is my code:

var AddGroup = function (Obj) {
    $('.Selectiontarget').live('post', function () {
        $.post('/List/AddGroupItem?ListID=' + Obj, function (data) {
            $('.Selectiontarget').html(data);
        });
    });
}

When I run this code I lose all of my click bindings.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript