Skip to content Skip to sidebar Skip to footer

JQuery error() method

Reading Time: < 1 minute

What is the error() method of the jquery and how to use it.This article is describing how to use it,usages,issues and so on.The error 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.
Syntax : .error(handler(eventObject))

Example :

  $('#elementID').error(function() {
     //-----
  });

Usage:
I want to check a image is exist or not.

  $('#imageID').error(function() {
     alert('Image does not exist');
  });