"Reset" a function after inserting content dynamically

People!

I'm developing a website where I have an "Offers List" (iframe). Inside this list (), I have few products.

If the user clicks on a product, this product goes to a "Wishlist" (other , on the parent window). Okay so far.

But, the user can delete the product selected from the "Wishlist". Okay so far. But the Wishlist is "refreshed" dynamically, (with .append() method, from an iframe), so my event $(".button_to_delete").click() event doesn't work, because the jQuery runs after the DOM. How I can "restart" the $(".button_to_delete").click() event after the product inserted in Wishlist?

My code: http://pastebin.com/uHevR1KL

Thanks! :) And sorry for bad english.

Answers


Try to use .on():

$("#listaPedidos").on('click','.button_to_delete',function(){
     //Do some stuff
});

Need Your Help

SurroundsWith Snippet for VS2012 Gives a Selection

c# visual-studio-2010 code-snippets

Since I defined the following snippet, I always get a unwanted selection when trying to use surround with.

SSH library for Java

java ssh ssh-tunnel

Does anyone know of a good library for SSH login from Java.