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

274
Vistas
how to make a js code not working on the first twoo times

I have a function named onAddressChange() which executes when a DOM ready 2 times. I don't want that because a success message that I have inserted on it should appear only when the function is triggered after a customer clicks on the change.

Is there any way to avoid entering this function after the DOM was initialized or something like that? I do not want the success message to appear the first time the page loads.

define([
  'jquery',
  'Magento_Checkout/js/action/select-billing-address',
  'mage/translate'
], function($, selectBillingAddress, $t) {
  'use strict';

  return function(Component) {
    return Component.extend({
      onAddressChange: function(address) {
        this._super();
        
        // showing succes message
        let messageSucces = $t('Your billing address has been updated');
        setTimeout(function() {
          $('.checkout-billing-address .billing-address-details').after('<div class="billing-address-msg">' + messageSucces + '</div>');
        }, 1000)
      }
    });
  }
});

in other expression, how to make this code not working on the first twoo times for example

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