Side navigation
#14553 closed bug (notabug)
Opened November 18, 2013 12:45PM UTC
Closed November 18, 2013 12:49PM UTC
Last modified November 18, 2013 01:04PM UTC
Ajax + Live (.on event)
Reported by: | LyonSH@mail.ru | 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.
Attachments (0)
Change History (3)
Changed November 18, 2013 12:49PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed November 18, 2013 12:56PM UTC by comment:2
// 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>');
Changed November 18, 2013 01:04PM UTC by comment:3
I'm sorry. Understood...
// Analog - Working jQuery 1.10.2
$(document).on("click", ".class1 .class2", function(){
alert("work?");
});
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.