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
How do I control timing of javascript execution in relation to other scripts loading dynamic content?

I've created a small piece of javascript to target some dynamically loaded HTML from a plugin script (YOTPO Reviews).

<script type="text/javascript">
if(window.location.hash) {
    document.getElementsByClassName('write-review-wrapper')[0].style.display = "block";
}
</script>

I'm running into 'x is not defined' type errors and I assume this is because my script is running before the Yotpo widget script has finished loading the HTML I'm selecting?

I know I can execute the script after the DOM has loaded with the window.onload state and this works, however because I've got so many other scripts that are taking time to load in, such as live chat, tracking etc. It's too slow and what I'm trying to achieve becomes somewhat pointless.

The YOTPO script loads in an acceptable time, but how can I get my script to execute just after it's loaded (if that is indeed the issue here)?

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