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

245
Views
¿Por qué no puedo agregar un detector de eventos usando el módulo Webpack?

Soy nuevo en Webpack y nodo, así que tengan paciencia conmigo. Estoy tratando de crear detectores de eventos globales en el cuerpo del documento y ejecutar funciones a medida que cambian/hacen clic, etc. Mi problema es que los detectores de eventos no se adjuntan al documento. Puedo inspeccionar el body y ninguno de los detectores de eventos está adjuntando. ¿Qué estoy haciendo mal?

  • El archivo se está cargando correctamente.
  • Recibo un error: e is undefined cuando se ejecuta la función validateProductAttribues(e) .
  • Intenté mover los detectores de eventos Click and Change al detector DOMContentLoaded , pero no funcionó.

Estoy tratando de organizar mi código así:

Producto.js

 import { validateProductAttributes, resetProductAttributes } from "./product-functions"; function runClickEvents(e) { resetProductAttributes(e); } /** * ======= CHANGE EVENT ========= */ function runChangeEvents(e) { if (e.target.id.includes("pa_")) { showAddOnsMessage(); validateProductAttributes(e); } } // Run Load Events document.addEventListener("DOMContentLoaded", runLoadEvents); // Run Click Events document.body.addEventListener("click", (e) => runClickEvents); // Run Change Events document.body.addEventListener("change", (e) => runChangeEvents);
 // Adds class of Validated to select box when an option is selected export function validateProductAttributes(e) { e.target.value !== "" ? e.target.classList.add("validated") : e.target.classList.remove("validated"); }
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!