Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
What is the difference between .onclick and .addEventListener("click", function())?

New to javascript and I find myself often trying one before realizing the other one is what I need, are they not doing the same thing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here are what I found for your questions: addEventListner:

  • Can add multiple events to a particular element.
  • Can take a third argument that can control the event propagation.
  • Can only be added within elements or in external JavaScript file.

On the other hand - onclick:

  • Can add only a single event to an element, and it is basically a property, so gets overwritten.
  • Event propagation cannot be controlled by onclick.
  • Can be added as an HTML attribute also.

Also, you can read more about the difference Here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda