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

353
Vistas
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
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