Tuesday, September 2, 2014

JavaScript and jQuery anatomy: element, event listener, and callback function

JavaScript
Here are each of the JS portions broken down into their parts:
ELEMENT: the element (class or ID you are trying to get) EVENT LISTENER: in this case, waits for the user to interact and registers that the click happened. CALLBACK FUNCTION (METHOD): once the event occurs, do stuff.
Now, let's do the same for..
jQuery:
Here are each of the jQuery portions broken down into their parts:
ELEMENT: the element (class or ID you are trying to get) EVENT LISTENER: in this case, waits for the user to interact and registers that the click happened. CALLBACK FUNCTION (METHOD): once the event occurs, do stuff.