Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialA X
12,842 PointsWhat is an Event Handler in jQuery?
From video: https://teamtreehouse.com/library/using-the-on-method
I'm not understanding what an event handler or an event is. Thanks!
2 Answers
Zakk George
4,550 PointsBasically an event handler is block of code waiting for an action to execute the code within. For example:
$( "#target" ).click(function() {
alert( "Handler for .click() called." );
});
When the user clicks on the target that the listener was placed the code inside the function will run. It will run EVERY time the target is clicked.
I hope this helped clear it up slightly! Happy Hacking!
ywang04
6,762 PointsEvent Handler is the call back function. Please refer to this course. https://teamtreehouse.com/library/listening-for-events-with-addeventlistener
Michael Quiban
5,702 PointsMichael Quiban
5,702 PointsA nice, and simple explanation.
Rifqi Fahmi
23,164 PointsRifqi Fahmi
23,164 PointsSo, is it the same as callback ???