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

95
Visualizações
execute js function after reloading page

I have a function that is executed when a link is clicked that contains certain content, but the situation is that after the click, the page is refreshed. I want to make it so that after refreshing the page my function would still be executed, tell me how to do it? For example, after clicking on the button, the function waits until the page is reloaded and after that it has already been completed. My code:

function refreshContent() {
...function here
}

    var textProp = 'textContent' in document ? 'textContent' : 'innerText';
    [].slice.call(document.querySelectorAll('a'), 0).forEach(function (aEl) {
        if (aEl[textProp].indexOf('English') > -1) {
            aEl.addEventListener("click", refreshContent)
        }
    })

I need that when I click on the link:

aEl.addEventListener("click", refreshContent))

, the script waits until the page is updated and after that the function refreshContent is executed

about 4 years ago · Santiago Trujillo
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