javascript - jQuery: Can't select just appended element -
this happens on event:
$('div#pages').append($('<div class="page" id="test">...</div>'));
and then, on event fails doing this:
var page = $('div.page#test'); // returns empty array
i've debugged, , appended html appears in document structure after appending, fails selected. doing same in browser console works perfectly.
problem?
use .find()
http://api.jquery.com/find
var page = $('div#pages').find('div.page#test');
Comments
Post a Comment