Reputation: 6316
Can someone please help me to understand what exactly is the "Event" and "Event handler" in following examples? According to www.w3schools.com here is the list of some common events
so why some people still keep saying Click event handler? is Click event or event handler?
1.
$( "p" ).click(function() {
alert("Which One is Event and which one Event Handler");
});
$("p").on("click",function(){
alert("Which One is Event and which one Event Handler");
});
$("p").css("background-color","yellow");
Upvotes: 0
Views: 61
Reputation: 7336
Following your code:
$("p").click(function() {
// this function is the event handler of the "click" event
});
which is the same as:
$("p").on("click",function(){
alert("Which One is Event and which one Event Handler");
});
The following code, is not an event, just changes the style of the p
elements:
$("p").css("background-color", "yellow");
Upvotes: 2
Reputation: 114347
The event is the action. The handler is the receiver of that action, usually a function.
Upvotes: 6