Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!