jQuery Tutorial


jQuery Example


jQuery References


jQuery error() Event Reference


  jQuery Events References


Uses

jQuery error() event Occurs when selected element not loaded successfully.


Bind a Function to error() event

Defined function run when the error() event occurs on the selected elements.

Syntax

$(selector).error(function) 

jQuery error() events supported following parameters.

ParameterDescription
functionFunction is Optional parameter. Function define the ready to run when event occur.

Example

<script type="text/javascript"> 
$(document).ready(function(){
  $("img").error(function(){
    $("img").replaceWith("Error Loading Image Not Open..!");
  });
});
</script>
Online Try This Code Your Self....   »

Trigger the error() event

Triggering the error event for a selected elements.

Syntax

$(selector).error() 

Example

<script type="text/javascript"> 
$(document).ready(function(){
  $("img").error(function(){
    $("img").replaceWith("Error Loading Image Not Open..!");
  });
  $("button").click(function(){
    $("img").error();
  });
});
</script>
Online Try This Code Your Self....   »

  jQuery Events References