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

109
Vistas
I want to upload random script.js files into one script tag?

I want to upload random script files into a script tag element. I Have tried this but it didn't work.

var randomTest = Math.floor(Math.random() * 5) +1; //generating random number
var randomTestJs = "test" + randomTest + ".js"; // targeting random question file source
var questionSource = "js/" + randomTestJs; //selecting question file source
var test = document.querySelectorAll("script")[0]; //selecting tag attribute
test.setAttribute("src", questionSource); //overwriting question file
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

this can't work. the script tags are executed when the side will be loaded. you try to run the scripts on the fly. this is not the way it works.

perhaps you try to load your questions in a json format with fetch and than work with it.

about 4 years ago · Juan Pablo Isaza Denunciar
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