Search code examples
jquery-selectorsjqueryjquery-on

live() and on() method, and FF browser


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?


Solution

  • Have you tried passing the event into the function?

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