For example, after using AJAX, I\'ll have a scrollable DIV. How to bind scroll events to it?
I\'ve tried:
$(window).on(\"scroll\", \".mydiv\", functi
http://jsfiddle.net/hainawa/cruut/
$(document).ready(function(){
var $mydiv = $('
Content1
Content2
');
// It will work
$mydiv.scroll(function(){
alert("A");
});
// Trigger
$("#btn").click(function(){
//You are using the method append,so you don't need judge if div.mydiv exits.
//You'll need do this if you're using display:none
$("body").append($mydiv);
});
});