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

307
Views
Establecer el foco en <botón> y hacer que el botón muestre el foco (resaltado)

Mi código es simple:

 <html> <body> Test <br> <button onclick="document.getElementById('btn2').focus();">Button 1</button> <br> <button id="btn2" onclick="alert('Hello world');">Button 2</button> </body> </html>

La pregunta es simple: el botón uno establecerá el foco en el botón 2. Sin embargo, el foco no es visible. Solo al presionar la tecla Shift, aparecerá el foco. El enfoque también se puede mostrar usando la tecla de tabulación, para seguir el enfoque. Quiero que el foco sea visible para el usuario.

Mi pregunta es ¿cómo puedo establecer el foco y hacerlo visible para el usuario?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede intentar hacerlo visible para el usuario agregando css a la página

https://developer.mozilla.org/en-US/docs/Web/CSS/:focus

 <style> #btn2:focus{ background-color: blueviolet; } </style>
about 4 years ago · Juan Pablo Isaza Report

0

¿es esto lo que quieres?

 button:focus{ outline: 1px solid red }
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!