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

91
Views
How to trigger a submit action for an input element or form while pressing enter key?

Have a simple search bar (input field) which should trigger an onSubmit action while we press Enter button

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

You can use onKeyPress. Check this : https://stackoverflow.com/questions/13987300/how-to-capture-enter-key-press

about 4 years ago · Santiago Gelvez Report

0

Simple, have a button type submit inside the form. Here's an example:

const onSubmit = () => {}
// ..
<form onSubmit={onSubmit}>
  ...
  <button type="submit">Search</button>
  ...
</form>

You don't need to use onKeyPress event.

about 4 years ago · Santiago Gelvez 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!