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

189
Vistas
How to set injected function at the very bottom of website?

I have a website that load some JS code from url which have select2() function, but i don't know why I can't call or use it using injected script (chrome extension) and got Uncaught TypeError: $(...).select2 is not a function. But I can run JQuery syntax by the injected script, the difference is JQuery.min.js script loaded inside the <head> tag but that select2 script is inside the <body> tag. Is there any way to access selec2() function without changing the website (like rearrange the script or others)? thank you!

This are the script of my custom chrome extension

const batchscp = function(){
  const injectElement = document.createElement('div');
  injectElement.className = "custombtn btn";
  injectElement.id = "mybtn";
  $('body').append(injectElement);

  spn = //many html elements to inject which contain a button with id=auto
  $('#mybtn').append(spn);
}
batchscp();

$('#auto').click(function (e) { 
  e.preventDefault();
  $('.select2').select2(); //Uncaught TypeError: $(...).select2 is not a function
  $('#logisticsAdd').val('65').trigger('change');
});
about 4 years ago · Juan Pablo Isaza
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