<pclass="arguement"><strong>handler(eventObject)</strong>A function to execute when the event is triggered.</p>
</li></ul>
<divclass="longdesc">
<p>This method is a shortcut for <code>.bind('error', handler)</code>.</p>
<p>The <code>error</code> event is sent to elements, such as images, that are referenced by a document and loaded by the browser. It is called if the element was not loaded correctly.</p>
<p>For example, consider a page with a simple image:</p>
<p>The event handler can be bound to the image:</p>
<pre>$('#book').error(function() {
alert('Handler for .error() called.')
});
</pre>
<p>If the image cannot be loaded (for example, because it is not present at the supplied URL), the alert is displayed:</p>
<p><spanclass="output">Handler for .error() called.</span></p>
<blockquote>
<p>This event may not be correctly fired when the page is served locally. Since <code>error</code> relies on normal HTTP status codes, it will generally not be triggered if the URL uses the <code>file:</code> protocol.</p>
</blockquote>
</div>
<h3>Examples:</h3>
<divid="entry-examples"class="entry-examples">
<divid="example-0">
<h4>Example: <spanclass="desc">To keep a server-side log of JavaScript errors, you might want to:</span>