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

102
Views
Activar la tecla Intro al hacer clic en el botón

He visto soluciones para activar un botón al presionar la tecla Intro, pero lo que me gustaría lograr es lo contrario. ¿Cómo puedo activar la tecla Intro al hacer clic en el botón usando JS?

 const triggerEnterKey = () => { ... } <button onClick={()=> {triggerEnterKey()}}>Trigger enter key</button>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Use dispatchEvent para enviar un

 new KeyboardEvent('keydown',{'key':'Enter'})
about 4 years ago · Juan Pablo Isaza Report

0

Por favor, intente esto.

 var evt = new KeyboardEvent('keydown', {'keyCode':13, 'which':13}); const textTag = document.getElementById("text"); window.addEventListener('click', () => { document.dispatchEvent (evt); textTag.innerHTML = "Enter was presseed"; });
 <h1>Simulate enter press on click</h1> <p id="text"></p>

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!