I want to make a small survey. I want that the user has to answer some questions. A new question is fading in after clicking an answer. But this only works one time, because the new question which was on display:hidden before is not in the DOM I think. So I need to refresh the DOM I think?
Here is an example: http://jsfiddle.net/x2yu6tvw/
qstnNo = $('.question').data('id');
$('.answer').on( 'click', function(){
$('.question[data-id="' + qstnNo + '"]').fadeOut(800, function(){
nextQstn = qstnNo+1;
$('.question[data-id="' + nextQstn + '"]').delay(300).fadeIn(300);
});
});
What can I do that jQuery listen also to the new added element?