live should work, try this.

$(".delButton").live("click", function(){
        $(this).parent(".parentOFbutton").remove();
        return false;
});




pascal.nauj...@googlemail.com wrote:
Hi,

i implemented the following method for removing a button with it's
parent:

                 $(".delButton").click(function(event){
                    event.preventDefault();
                    $(this).parent(".parentOFbutton").remove();
                 });

this works fine.

Now i added a script which dynamicly adds those "delButton"s to my dom-
tree with when the user creates a new record:

$(".parentOFbutton:last").append(' [<a href=\#" class="delButton">DEL</
a>]');

This also works.

But now my $(".delButton").click(function(event){ ... doesn't! Is this
cause of appending the buttons on the runtime of the script? Is there
a workaround? I found and tried the "live" method from jquery (http://
docs.jquery.com/Events/live#typefn) but i also can't get this to work
*confused*

Thanks for help
qualle

Reply via email to