$('body').on('click', function () {
$( '.detailTextContainer a' ).each(function() {
var urlFoto = $(this).attr('href');
var imgElement = $("<img />").attr('src', urlFoto)
.addClass('dalsiFoto');
$(this).empty().append( imgElement );
});
});
How can I run this function automatically after load page (without event). '.detailTextContainer a'
are dynamic elements, which are loaded to page immediately after start page.
I tried this code:
function showImage (){
$( '.detailFeatureDesc a' ).each(function() {
var urlFoto = $(this).attr('href');
var imgElement = $("<img />").attr('src', urlFoto)
.addClass('dalsiFoto');
$(this).empty().append( imgElement );
});
};
showImage();
But this weren't successfully.
Thanks