0

I have this code that use live method, and it works in Opera and Chrome:

 $(".dynamicaly_created_div").live("click",function(){
    $(event.target).parent().remove();
 });

But not in the FF. So i tried to replace "live" with "on" (i read somwhere that live is deprecated). But then, this does not work in any browser.

Is ther any solution for this?

SomeoneS
  • 1,207
  • 2
  • 19
  • 34

1 Answers1

6

Have you tried passing the event into the function?

$(".dynamicaly_created_div").live("click",function(e){
    $(e.target).parent().remove();
});
White Elephant
  • 1,361
  • 2
  • 13
  • 28
  • Yes, this works, tnx a lot :) And, yes, i tried something like this, but i did not used it correctly, so it did not worked. – SomeoneS Jul 25 '12 at 14:36