We would like to know how to handle img load event.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-2.0.2.js'></script>
<script type='text/javascript'>
$(function(){<!--from ww w. java2 s . c o m-->
console.log("hey");
$('#foo').load(function(e) {
console.log("loaded");
console.log(e);
});
});
</script>
</head>
<body>
<img id="foo" src="http://www.java2s.com/style/download.png" />
</body>
</html>
The code above is rendered as follows: