When you write JavaScript in the browser, you’re writing event-driven code. Most of your code will be executed when something happens, such as having content slide in when a user clicks a link. Even though you might not have realized it, you’ve already written some event-based code:
$(function() {
});
You’ve been writing code that runs when the document is ready, as previously explained. This is an event that you’re attaching code to. It is also known as binding. Keeping ...