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

123
Views
using jquery getScript to load js file

In index.html I load p5:

and use jQuery to load another page on a button click:

<script>
    $(document).ready(function(){
        $("#btn").click(function(){
            $("#contentx").load("content1.html");
        });
    });
</script>

and it works fine. In content1.html I have (among other things):

<script>
    var url = "drawfarm.js";
    $.getScript(url);
</script>

to load a script containing the p5 content and I get an error:

"p5.min.js:3 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild')"

Can someone explain what's going wrong?

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!