Interactive Content and Event Listeners
You are now familiar with the basic manipulation of the Document Object Model (DOM). In the last chapter, we had a look at events, and we saw that event listeners are constantly monitoring for whether a certain event is taking place; when it does occur, the specified event (a function) gets invoked.
In this chapter, we are going to take this knowledge one step further and use event listeners to create interactive web content. This chapter is really going to complete your DOM knowledge. We are going to cover the following topics:
- Interactive content
- Specifying events
- The
onload
event handler - The mouse event handler
- The event target property
- DOM event flow
onchange
andonblur
- The key event handler
- Drag and drop elements
- Form submission
- Animating elements
Note: exercise, project and self-check quiz answers can be found in the Appendix.