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

192
Views
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
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!