jQuery load() method
Example
Alert text when all images have loaded:
$("img").load(function(){
alert("The image has loaded");
});
Try it »
Definition and Usage
The load() method wasDeprecated..
The load() method adds an event handler to the load event.
The load event occurs when the specified element has loaded.
This event applies to any element with a URL (such as images, scripts, frames, iframes) as well as the window object.
Depending on the browser (Firefox and IE), the load event may not be triggered if the image has been cached.
**Note:** There is also a jQuery AJAX method named load(). Which method is called depends on the arguments.
Syntax
$(
selector
).load(
function
)
| Parameters | Description |
|---|---|
| function | Required. Specifies the function to run when the specified element has finished loading. |
More examples
Display some text when all images have loaded
How to change the text when all images have loaded
Alert text when the page has fully loaded
Alert text when the window object (including images) has fully loaded.
jQuery event methods