We are finally here — interaction, the last missing part in our frontend web development toolkit. Once you’ve covered this material, you will technically know everything you need about HTML, CSS and Javascript in order to build relatively complex (and functional) static websites. (static doesn’t mean no interaction, or fun, it just means no backend or dynamic data. The HTML you wrote is all the website has.)
As mentioned in the Web Time tutorial, Javascript is an event-based programming language, meaning that it allows us to easily implement certain logic (read execute a function) when certain events happen.
When talking about time on the web, those events had to do with time. setTimeout
's event can be verbally described as X seconds in the future
. setInterval
's event can be verbally described as starting now, every X seconds
.
In this tutorial we will look at user-generated events, things like when the user clicks on this <div>
, or when the user types the letter "X" on their keyboard.
on
method