This is what happens on event:
$(\'div#pages\').append($(\'...\'));
And then, on another eve
This is my solution that works fine for appended elements.