This is what happens on event:
$(\'div#pages\').append($(\'...\'));
And then, on another eve
I had to use a hack to get around this problem recently when I was dynamically inserting elements. I changed this:
var $item = $('#appendedItem1'); // returns: []
to this:
var $item = $(document.getElementById('appendedItem1')); // returns: [select#appendedItem1]
I know it seems like it should be the exact same thing, but only the second one works.