How to use JQuery Event load() Method

This article describe about jQuery Event load() Method.
  • 1720

jQuery Event load() Method

When a definite element or sub element loaded the load() event occur.

This event work with the element URL only (ex- image, frame etc).

The load may not trigger it depend on the browser, if the image is cached.

Syntax

$(selector).load(function)

 

Parameter Description
function Required. It is define a function to run when any specific image load.

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("img").load(function () {

            $("div").text("Image loaded");

        });

    });

</script>

</head>

<body>

<img src="Record-Player-1.jpg" alt="Cinqueterra" width="304" height="236" />

<div>Image is currently loading.</div>

<p><b>Note:</b>The load event may not trigger if the image is cached depending on the browser.</p>

</body>

</html>

 

Output

 

load() method pic44.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.