W3Schools.com

jQuery Event load() Method

jQuery Event Methods jQuery Event Methods

Example

Change the text of a div element when an image is loaded:

$("img").load(function(){
  $("div").text("Image loaded");
});

Try it yourself »

Definition and Usage

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.

Syntax

$(selector).load(function)

Parameter Description
function Required. Specifies the function to run when the specified element is done loading.


jQuery Event Methods jQuery Event Methods


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE