How to attach load event to an element in jquery ?

 Posted by Vivek.Ramapuram on 11/7/2014 | Category: jQuery Interview questions | Views: 677 | Points: 40
Answer:

in the script type we have to attach load method to an html element, load() method is used for the load function
Example:
<script type="text/javascript">

<img id="imgLoad" src="http://www.itfunda.com/Images/itfunda.gif" />
$("#imgLoad").load(function () {
alert("ITFunda.Com Logo loaded");
});
</script>

when the image will be loaded completely then user will be alerted from the above example


Asked In: spotted while learning | Alert Moderator 

Comments or Responses

Login to post response