$(function(){
$('button').click(function(){
$('p').addClass('red');
});
$('body').on('.red','click',function(){
alert(''); // doesn't work?
});
});
Why does the red class
's click event doesn't fire? I thought by using on()
it will catch any future coming classes?
Is it because of closure problem?