Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 476991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:32:45+00:00 2026-05-13T00:32:45+00:00

As the title says, I want the ‘select file’ dialog to open when a

  • 0

As the title says, I want the ‘select file’ dialog to open when a certain input gets focus by tabbing through the form fields (using keyboard navigation). By default, the ‘select file’ window only opens when the field is clicked.

I put up a page on JS Bin for this issue: http://jsbin.com/areba/edit

Currently, this page consists of the following code:

<!doctype html> 
<html> 
 <head> 
  <title>Sandbox</title> 
  <meta charset="utf-8"> 
 </head> 
 <body> 
  <form> 
   <input type="text"> 
   <input type="file">
  </form>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  <script>
   $(function() {
    $('input[type=text]').focus(function() {
     $(this).next('input[type=file]').css('background', 'lime').trigger('click');
    });
   });
  </script>
 </body> 
</html>

As you can see, there is a text input and a file input. The idea is that when the text input receives focus, the file input gets ‘clicked’ or whatever and the ‘select file’ window opens.

The .css('background', 'lime') statement seems to work fine; however, invoking .trigger('click') on the file input seems to do nothing at all.

(I realize this might cause an accessibility problem, so please, let’s not discuss that. Thanks.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:32:46+00:00Added an answer on May 13, 2026 at 12:32 am

    This will work in IE and Safari (I think), but not in Opera or Firefox, as they haven’t implemented the click() event for file upload elements – edit: yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So as the title says I'm trying to add input tags to a form
It's basically what the title says.. I have a form with a select control
Just as the title says, I want something in the likes of: SELECT *
As title says. I want to perform and order by on a list -
I just want what my title says.I have already read all the previous similar
The title says it mostly. If I have an object in Python and want
Basically what the title says, I want to get the URL and HTTP Verb
Though the title says everything, I want to let you know the particular scenario
What the title says. I want to know if there something in the JDK
as the title already says, I want to execute a linux comand with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.