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

  • SEARCH
  • Home
  • 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 8421873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:16:19+00:00 2026-06-10T03:16:19+00:00

I have this small problem with a website I’m designing. It’s fairly over, but

  • 0

I have this small problem with a website I’m designing. It’s fairly over, but I think the jQuery is the problem here.

The code is as follows:

<img src="files/register_page/upload_photo/body.png" id="upload">
<input type="file" name="file_upload" id="file_upload" style="visibility:hidden;">

And the jQuery is the following, in the part of the document:

$(document).ready( function(){
      $("#upload").click( function(){
          $('#file_upload').click();
      });
    });

However, upon clicking the img, nothing happens, where a file upload dialog should pop up.
Please, if you need any more information or something, let me know. If not, what could the problem be here? I’m using jQuery 1.8.0.

  • 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-06-10T03:16:21+00:00Added an answer on June 10, 2026 at 3:16 am

    Using HTML5 label element:

    <label for="file_upload"><img src="files/register_page/upload_photo/body.png" id="upload"></label>
    <input type="file" name="file_upload" id="file_upload" style="visibility:hidden;">
    

    Fiddle

    Works in Chrome, IE and Opera but not FF.

    Browsers tend to limit what you can do with input type="file". The label element redirects the focus to the input with the id property equal to its for property, so this is an workaround to trigger the invisible element.


    Modern browsers have alleviated a good part of those restrictions though, so you can trigger the .click() without problem.

    You may however, change the CSS hack to hide it without using display:none or visibility:hidden for back-compat with older browsers. Either

    position:absolute; top:-100px;
    

    Or

    opacity:0;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    filter: alpha(opacity=0);
    width:0; height:0;
    

    Can hide the element without using the display or visibility CSS properties.

    Fiddle


    Also, here’s an workaround for the label element on FF, you can change the visibility:hidden by opacity:0 and:

    $('#file_upload').focus(function() {
        $(this).click();
    });
    

    Fiddle. But this should be unnecessary if the primary script works fine.

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

Sidebar

Related Questions

i have a small problem here which i cannot fix,This post goes through but
I just finished a small website 100% based on ajax.But i have a problem
my website for the most part works well, but I have one small problem
I'm having a small problem. I have this grid with a column: <data:DataGrid ColumnHeaderStyle={StaticResource
I am stuck at a small problem. I have this button within a form
i have a small problem i have xome xml with a cdata section. This
While doing some small regex task I came upon this problem. I have a
This is Uday. I have a problem with the write performance with a small
I have a small problem. I use a Frame to show a website, unfortunateli
I have a small problem on a website with a background element in CSS

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.