June 15, 2013
.fadeto() not working for dynamic class in jquery
User2488882’s Question:
My Code is like this.
<script>
var i=0;
$(window).load(function() {
$(function() {
setInterval(update, 1000);
});
function update() {
i++;
setTimeout(function(){$("#container").after($('<div>',{text:'Hello',class:'test'+i}))},100);
$("#container .test"+i).delay(500).fadeTo('slow',0);
}
});
</script>
.after() seems working.
But .fadeto() doesn’s work.
I know there are utilities for dynamic classes like .on() and .live() .
But I dont know how can .fadeTo be working for dynamic classes.
Any ideas?