load

英[ləʊd] 美[loʊd]

n.Load; load; burden; workload

vt. To bear ;Load; load or load...; fill, pile up

vi.Load; load; load

jquery load() method syntax

Function:When the specified element (and sub-elements) has been loaded, the load() event will occur. This event applies to any element with a URL (such as images, scripts, frames, iframes). Depending on the browser (Firefox and IE), the load event may not be fired if the image has been cached. There is also a jQuery Ajax method called load() that takes different parameters.

Syntax: $(selector).load(function(){})

Parameters:

ParametersDescription
function Required. Specifies a function to be run when the specified element is loaded.

jquery load() method example

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("img").load(function(){
    $("div").text("图像已加载");
  });
});
</script>
</head>
<body>
<img src="http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg" />
<div>图像正在加载中 ...</div>
<p><b>注释:</b>根据不同的浏览器(Firefox 和 IE),如果图像已被缓存,则也许不会触发 load 事件。</p>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance