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

206
Vistas
Chrome Extension: Adding click event handler to button not working

I have been trying to add a click event handler on to a button in my chrome extension. No matter what I try, the function "save" will not activate on button click. The index.html file looks like this:

<!doctype html>
<html>
    <head>
    </head>
    <body>
        <textarea id="notes" rows="4" cols="50"></textarea>
        <button id="save-button">Save</button>
        <script src="popup.js"></script>
    </body>
</html>

And the code to add the event handler on to the button looks like this:

function save() {
  console.log('SAVE TEST')
}

document.addEventListener('DOMContentLoaded', function () {
  const saveButton = document.getElementById('save-button')
  saveButton.addEventListener('click', save);
});

I have confirmed that the saveButton.addEventListener is being called. I've looked everywhere online and it seems like I am doing things right, but I must be messing up somewhere that I just cannot figure out...

about 4 years ago · Juan Pablo Isaza
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