Callback is a function that is passed to another function as parameter and callback function is called inside another function.
Example:
Here following are callback function.
The trigger is code that is executed automatically on some events.
Example:
Handler: An event handler executes a part of a code based on certain events occurring within the application such as onClick, onBlur, onLoad etc.
Example:
Following are few more event handler
Example:
$("#MyButton").click(function(){ $("p#hideDiv").hide("slow", function(){ alert("function() is callback and called."); }); });
Here following are callback function.
function(){ alert("function() is callback and called."); }
The trigger is code that is executed automatically on some events.
Example:
Handler: An event handler executes a part of a code based on certain events occurring within the application such as onClick, onBlur, onLoad etc.
Example:
$(document).ready(function(){ $("button").click(function(){ $("input").trigger("select"); }); });
Following are few more event handler
Event | Description |
---|---|
onchange | An HTML element has been changed |
onclick | The user clicks an HTML element |
onmouseover | The user moves the mouse over an HTML element |
onmouseout | The user moves the mouse away from an HTML element |
onkeydown | The user pushes a keyboard key |
onload | The browser has finished loading the page |