ExampleChange the text of a div element when an image is loaded:
Try it yourself » |
The load() event occurs when a specified element (and sub elements) has been loaded.
This event works with any element with an URL (like image, script, frame, iframe).
Depending on the browser, the load event may not trigger if the image is cached (Firefox and IE).
Note: There is also a jQuery Ajax method called load. Which one is called, depends on the parameters.
$(selector).load(function) |
Parameter | Description |
---|---|
function | Required. Specifies the function to run when the specified element is done loading. |