Events in JavaScript
Events are things that happen in the browser: a user clicks a button, moves the mouse, presses a key, submits a form, or the page finishes loading. JavaScript can 'listen' for these events and run code in response.
This is what makes web pages interactive – without events, nothing responds to the user.
Common Event Types
- Mouse events: click, dblclick, mouseover, mouseout, mousemove
- Keyboard events: keydown, keyup, keypress
- Form events: submit, change, input, focus, blur
- Window/page events: load, resize, scroll
- Other: touchstart/touchend for mobile
The Event Object
When an event happens, the browser creates an event object with details: which element, mouse position, pressed key, etc.
Basic Event Examples
Keyboard Events
Form Events
Quick Quiz
Wir haben die Materialien überprüft, dennoch können Fehler vorkommen. Der Inhalt dient ausschließlich Bildungszwecken, daher verwende ihn auf eigene Verantwortung und überprüfe ihn bei Bedarf mit anderen Quellen.
✨ Frag Lara — deine KI-Lernpartnerin
Entsperre personalisierte Lernunterstützung. Lara kann Lektionen erklären, Themen zusammenfassen und deine Lernfragen beantworten — verfügbar ab dem Go-Tarif.
Lara hilft dir, schneller zu lernen — exklusiv für ReadyTools Go-, Plus- und Max-Mitglieder.

