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

144
Views
tabindex is given it is focusing but on enter key enter it won't work

When I click on search icon with mouse it works fine , but when i use tab and focus goes to icon but when i enter "ENTER" keyword it won't work .

` <%-- Mobile Only - Search Icon --%>
 <div class="mobile-header-icon" onclick="OnClickSearchIcon();" tabindex="0" 
           aria-label="Search">
     <i class="search" ></i>
        </div>`
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Pressing enter does not fire a click event.

You could add a listener for e.g. keyup event.


Here is a full working example:

function OnClickSearchIcon(){
  // do whatever you want instead of this
  document.body.innerHTML += "<p>Search!</p>";
}

function onKeyUp(e){
  if (e.key === "Enter") OnClickSearchIcon();
}
<div tabindex=0 onkeyup="onKeyUp(event)" onclick="OnClickSearchIcon()" >
  <i class="search" >Click, or focus me and press Enter</i>
</div>

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!