can't select just injected elements
Hello Community,
I'm new to jQuery and jQuery Mobile developing, but I resently desided to give jQuery Mobile a try, rather then developing native android apps.
But I am stuck for over two days now, at the point, that I'm not able to select just injected Elements.
The injecting takes place in the pagebeforechange event wich I register as followed:
-
$(document).bind( "pagebeforechange", function( e, data ) {
-
//recognize right pagechange
- //inject photogallery
-
}
And the selection takes place in the pageshow event, which I register as followed:
-
$('div.gallery-page').live('pageshow', function(e){console.log('pageshow');
-
var currentPage = $(e.target);
- console.log(currentPage.attr('id'));
-
var options = {};
-
console.log($("ul.gallery a", e.target));
-
});
But the last log only shows an empty jQuery Object. But the page is shown right. Therfore I see the elements, that the selector does not select. Both rendered and in the DOM in Opera Dragonfly. And I see the elements when I select the body tag. I even tried just selecting all anchor-elements, or all img-tags but the resently injected weren't selected.
-
<ul class="gallery" id="10150125627794020">
-
<li>
-
<a href="https://..." rel="external">
- <img src="https://..."/>
-
</a>
- </li>
-
</ul>
But if I do a manuel page chachge by clicken in the menubar the selection is correct.
So can you please help me, and reveal the trick to me?
best regards,
angelo hannes