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

57
Vistas
Add event handler to HTML Progress tag

I´m trying to assign an event handler for a HTML tag, I want to fire a function when the value changes, but none events are fired..

<progress
   id="side-cart__progress-bar" 
   class="side-cart__progress-bar"
   first-gift="{{ section.settings.product_1_progress_bar.id }}"
   first-goal="{{ first_goal }}"
   second-gift="{{ section.settings.product_2_progress_bar.id }}"
   second-goal="{{ second_goal }}"
   final-gift="{{  section.settings.product_3_progress_bar.id}}" 
   max="{{ final_goal }}" 
   value="{{ cart.total_price }}"
  >
</progress>

Here's my JS:

const $sideCartProgressBar = document.querySelector("#side-cart__progress-bar")

$sideCartProgressBar.addEventListener("change", function(){
   console.log('Hello')
}) 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

<progress> does not support a change event listener. In addition, as far as I know, it raises no event when you change its value.

You can see, for example, MDN documents the existence of the change event on <select> but there is no similar documentation of change event on <progress>, supporting my claim that there is no such event for <progress>. In fact, there are no documented events for <progress> at all (besides inherited DOM events).

You should find some other way to do this, such as modifying the code which updates cart.total_price to do something extra when final_goal is reached.

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