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

356
Views
Is there a simple way to perform the equivalent of a PHP include() in Javascript?

I have several forms pages which share some of the same fields. These field-sets have been turned into reusable code modules and are imported into each page's DOM using PHP require() statements.

These field-sets have corresponding jQuery event handlers which perform field validation as well as miscellaneous UI-related tasks. I would like to make these handlers reusable, as well.

Previously, I've always declared such handlers within the $(document).ready() event.

If I'm going to import these handlers from an external file, it is my understanding they still need to be included directly into the $(document).ready() event, rather than imported using a standard HTML <script> tag pair.

In PHP, I'd simply include() or require() the code block like I do with the field-sets. How do I perform the equivalent in JS as simply as possible? Preferably without adding yet another framework, I might add.

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!