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

128
Views
diferentes formas en javascript de agregar Event Listener al DOM del navegador

En javascript, ¿cuáles son las diferentes formas de agregar un detector de eventos al navegador DOM? Probé el siguiente código y me preguntaba si hay más formas de hacerlo.

 let div = document.getElementById("div"); let btn = document.getElementById("btn"); function sayHello() { div.innerText = "Hello World"; console.log("awesome"); } btn.addEventListener("click", sayHello);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En JavaScript, hay dos formas de manejar eventos.

  • Uno de ellos es addEventListener que usó usted mismo.
  • Otra opción es onEvent , aquí hay un ejemplo:

JavaScript

 let hiButton = document.getElementById('someButton'); function sayHello() { console.log("Hi"); } hiButton.onclick = sayHello();
about 4 years ago · Juan Pablo Isaza Report
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!