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

206
Visualizações
Js not loading post link clicks within page

Following is my code to update the price of an item on the page, but the page has some anchor tags that lead to a different url(categories of items to filter) without page refresh and since there is no page refresh, the script isnt loading. I tried turbolinks:load as well with no luck.

    var $ = jQuery.noConflict();
    
$(document).on('ready', function() {
setTimeout(checkPaqe, 3000);
});
        function checkPaqe() {
           var pageType = 'NA';
             pageType = (dataLayer.find(dataLayer => dataLayer.PageType)["PageType"] != null) ? dataLayer.find(dataLayer => dataLayer.PageType)["PageType"]: "NA"
         if (pageType === 'ListingPage' || pageType === 'ProductPage' || pageType === 'HomePage') {
             updatePrice();
         }
     }
     
     
     
     function updatePrice() {
         let pricetags = document.getElementsByClassName("price");
         for (let i = 0; i < pricetags.length; ++i) {
             var price = pricetags[i].innerHTML;
             price = price.replace('$', '');
             price = parseFloat(price) - 30;
             price = parseFloat(price).toFixed(2);
             pricetags[i].innerHTML = "<s style=\"color:red\">" + pricetags[i].innerHTML + "</s><br><span style=\"font-size: 10px;\">Your price with loyalty voucher <span style=\"font-size: 2.0em;\">$" + price + "</span></span>";
         }
     }
window.onhashchange = function() { 
     console.log('hashchange');  
}

window.onpopstate = function() { 
console.log('popchange');
}   
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