i want to execute a Command after finish loading a Div. Should be easy, but i couldn´t handle it.
//With window it works fine
$(window).load(function()
{
alert($("#firstAmazon").attr("class"));
});
//With an other Object not
$("#firstAmazon").load(function()
{
alert("firstAmazon loaded");
});
<div class="socialIcon" id="firstAmazon">
<a href="amazon" title="Amazon">
<img src="../img/socialBar/amazon.png">
</a>
</div>
That comment was very helpful
div elements do not raise a load event, only the document, window and img elements do. – Rory McCrossan 16 mins ago
Actually i want to execute teh command after loading the img (amazon.png), So document ready don´t help me.
it works not like the documentation. I want that the load() fires after the Image is loaded.
$("#firstPic").load(function()
{
alert("firstPic loaded");
});
<div class="socialIcon">
<img id="firstPic" src="http://www.smartturtle.com/img/header.jpg">
</div>
here the documentation http://api.jquery.com/load-event/
$( "#book" ).load(function() {
// Handler for .load() called.
});
<img src="book.png" alt="Book" id="book">