0

I have this:

$(".sf_sub_accordian, .sf_find_container").bind("click", function(event) {
    event.stopPropagation();
});

But it stops working when I add content dynamically via ajax-call.

How to make bind work with dynamically created content?

Edit: Without success I have already tried this:

$(document).on("click", ".sf_sub_accordian, .sf_find_container",function(event) {
        event.stopPropagation();
});

In fact, it doesn't work at all if I do it like that.

GotBatteries
  • 1,226
  • 1
  • 17
  • 27
  • 1
    Check this: http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements and this http://stackoverflow.com/questions/16058402/dynamic-created-content-is-not-binding-jquery-events – Pedro Corchero Murga Aug 31 '15 at 14:36
  • `$(document).on("click", ".sf_sub_accordian, .sf_find_container",function(event) { event.stopPropagation(); });` – Satpal Aug 31 '15 at 14:39
  • @PedroCorcheroMurga: I've seen those answers already and tried that. jquery.on() doesn't work. Propagation is not stopped. – GotBatteries Aug 31 '15 at 15:06

0 Answers0