jQuery Event - load() Method
Example
Change the text of the div element when the image is loaded:
$("img").load(function(){ $("div").text("Image loaded"); });
Definition and Usage
The load() event occurs when the specified element (and its child elements) have been loaded.
This event applies to any element with a URL (such as images, scripts, frames, inline frames).
According to different browsers (Firefox and IE), if the image has been cached, the load event may not be triggered.
Note:There is also aThe jQuery Ajax method named load()varies according to different parameters.
Syntax
$(selector).load(function)
Parameters | Description |
---|---|
function | Required. Specifies the function to be executed when the specified element is loaded. |