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

135
Vistas
On load instead of document ready with other javascript on page?

I currently have this bit of code going that looks for a certain class and adds the QTY text inside the class. I have to do it this way as I don't have access to the base HTML code for this portion of the site, but rather can do so via JS access.

The current code I have running is as follows:

$('.cart-product-qty').each(function() {
  $(this).prepend("QTY: ");
});

But the problem I just ran into is when certain functions are performed in the shopping cart it doesn't refresh, so it ends up dropping the QTY text. Is there another method so that it keeps it there continuously even if the page "refreshes"?

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

0

Listen to the parent div underneath the products will be listed. So whenever the content changes, you can trigger your function.

DOMSubtreeModified event might be helpful.

var element = document.getElementById('div');

element.addEventListener('DOMSubtreeModified', updateQtyText);

function updateQtyText(e) {
    $('.cart-product-qty').each(function() {
     $(this).prepend("QTY: ");
   });
}

Reference : fire a call when inner HTML changes.

This might help

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