#14553 closed bug (notabug)
Ajax + Live (.on event)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
// Analog .live in other jQuery $(".class1").on("click", ".class2", function(){ alert("work?"); }); // Example - Ajax Next Page $("body").html('<div class="class1"><div class="class2">Not working!</div></div>');
Not working.
Change History (3)
comment:1 follow-ups: 2 3 Changed 9 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 9 years ago by
// Working jQuery 1.7.1 $(".class1 .class2").live("click", function(){ alert("work!"); }); // Analog - Not Working jQuery 1.10.2 $(".class1").on("click", ".class2", function(){ alert("work?"); }); // Example - Ajax Next Page $("body").html('<div class="class1"><div class="class2">Not working!</div></div>');
comment:3 Changed 9 years ago by
I'm sorry. Understood...
Analog - Working jQuery 1.10.2 $(document).on("click", ".class1 .class2", function(){
alert("work?");
});
Note: See
TracTickets for help on using
tickets.
It's working just fine. That's not actually an equivalent for what you want, since you're binding to
.class1
, but that element (if it even exists) is removed as soon as you replace the entire body content. Please ask for help on the forums or Stack Overflow.