Is there a method, similar to $(document).ready()
, that can be applied
to an arbitrary element? For example, if an ajax call sets the content
of a DIV
and includes a lot of IMG
tags, is there a way to trigger
a function call when all of the images have completed loading? Something
along the lines of:
$.ajax({
url: '/get/my/page.php',
dataType: "html",
success: function(response)
{
$('#my_element').html(response);
$('#my_element').ready(function() {alert('all images loaded');});
}
});
Thanks for your advice.