Events in JavaScript

Crear ElementosOyentes de Eventos

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

Hemos revisado y comprobado los materiales, pero aún pueden existir errores. El contenido se ofrece únicamente con fines educativos, así que úsalo bajo tu propia responsabilidad y verifica con otras fuentes si es necesario.

✨ Pregunta a Lara — tu compañera de estudio con IA

Desbloquea soporte de aprendizaje personalizado. Lara puede explicar lecciones, resumir temas y responder tus preguntas — disponible desde el plan Go y superiores.


Lara te ayuda a aprender más rápido — exclusivo para los miembros ReadyTools Go, Plus y Max.

Sigue Tu Progreso 🚀

Aprende más fácilmente siguiendo tu progreso completamente gratis.