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

96
Vistas
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 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