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

165
Views
En mi código javascript, Firefox no reconoce la tecla corta doble para navegar por un archivo

Quiero las teclas cortas Alt+O para buscar un archivo en mi página web. El evento "Keydown" puede manejar este problema perfectamente en Chrome, sin embargo, en Firefox no sucede nada a menos que haga clic en la página. ¿Hay alguna solución a mi problema?

 $(document).ready(function(){ $("body").keydown(function(e){ var keyCode = (e.which) ? e.which : window.e.keyCode; if(e.altKey) if(keyCode == 79){ //Alt+O = openFile e.preventDefault(); $("#xmlFile:hidden").trigger('click') } }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="file" id="xmlFile" style="display: none;" >
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No puede usar el gatillo de esta manera, esta respuesta lo ayuda a comprender. El disparador jQuery no funciona en Firefox

prueba esto:

 $(document).ready(function(){ $("body").keydown(function(e){ var keyCode = (e.which) ? e.which : window.e.keyCode; if(e.altKey) if(keyCode == 79){ //Alt+O = openFile e.preventDefault(); document.getElementById('file-input').click(); } }); });
 <input id="file-input" type="file" name="name" style="display: none;" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

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!