Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

276
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda