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 9188883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:07:09+00:00 2026-06-17T20:07:09+00:00

I placed a modified CSS file upload field inside a jQuery UI dialog box.

  • 0

I placed a modified CSS file upload field inside a jQuery UI dialog box. Everything works except when I click on the upload field, the dialog box to choose a file does not open. How can I fix this?

Here is the jsfiddle.

Here is my javascript:

$(function() {
  $("#dialog").dialog({
    autoOpen: false,
    width: 400,
    modal: true,
    buttons: [{
      text: "Submit",
      click: function() {
        $( this ).dialog( "close" );
      }
    },
    {
      text: "Cancel",
      click: function() {
        $(this).dialog("close");
      }
    }]
  });
  // Link to open the dialog
  $("#dialog-link").click(function(event) {
    $("#dialog").dialog("open");
    event.preventDefault();
  });
  // Hover states on the static widgets
  $("#dialog-link, #icons li").hover(
    function() {
      $(this).addClass("ui-state-hover");
    },
    function() {
      $(this).removeClass("ui-state-hover");
    }
  );
});

My CSS styles:

body{
  margin: 0;
  padding: 0;
  color: #666;
  font-family: Tahoma, Geneva, sans-serif;
  font-size:13px;
  line-height: 1.4em;
  background-color: #f7f7f7;
  background-repeat: repeat-x;
  background-position: top;
}
.demoHeaders {
  margin-top: 2em;
}
#dialog-link {
  padding: .4em 1em .4em 20px;
  text-decoration: none;
  position: relative;
}
#dialog-link span.ui-icon {
  margin: 0 5px 0 0;
  position: absolute;
  left: .2em;
  top: 50%;
  margin-top: -8px;
}
#icons {
  margin: 0;
  padding: 0;
}
#icons li {
  margin: 2px;
  position: relative;
  padding: 4px 0;
  cursor: pointer;
  float: left;
  list-style: none;
}
#icons span.ui-icon {
  float: left;
  margin: 0 4px;
}
.fakewindowcontain .ui-widget-overlay {
  position: absolute;
}
#FileUpload {
  position:relative;
}
#BrowserVisible {
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 1;
  background:url('https://i.stack.imgur.com/PaT3a.png') 100% 1px no-repeat;
  width:345px;
  height:30px;
}
#FileField {
  width:250px;
  margin-right:85px;
  padding: 6px;
  font-size: 13px;
  background: #fff url('bg-form-field.gif') top left repeat-x;
  border: 1px solid #d5d5d5;
  color: #333;
  border-radius: 4px 4px 4px 4px !important;
}
#BrowserHidden {
  position:relative;
  width:345px;
  height:30px;
  text-align: right;
  -moz-opacity:0;
  filter:alpha(opacity: 0);
  opacity: 0;
  z-index: 2;
}

Here is the HTML:

<p><a href="#" id="dialog-link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Open Dialog</a></p>
<div id="dialog" title="Update Profile Picture" style="font-size: 12px;">
  <div id="FileUpload">
    <input type="file" size="24" id="BrowserHidden" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" />
    <div id="BrowserVisible"><input type="text" id="FileField" /></div>
  </div>
</div>

I tested the upload form by placing it outside the dialog box and it works. Only when it is placed inside the jQuery UI dialog box, is it not working.
Here is the jsfiddle link http://jsfiddle.net/Tdkre/1/ which is working when placed outside dialog

  • 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-17T20:07:10+00:00Added an answer on June 17, 2026 at 8:07 pm

    Set the z-index of the file upload higher than that of the dialog window.

    #BrowserHidden {
        position:relative;
        width:345px;
        height:30px;
        text-align: right;
        -moz-opacity:0;
        filter:alpha(opacity: 0);
        opacity: 0;
        z-index: 1050; //z-index of dialog is 1002, causing it to appear above input
    }
    

    Working Demo: http://jsfiddle.net/JXHPc/1/

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

Sidebar

Related Questions

I downloaded and modified a style file and placed it in the Notepad++ themes
Im using a modified version of Eric Bidelman's/HTML5Rocks cachebust.py file for css/js. link is
i placed one button in a page .when click on that need to show
I've placed a table inside a div and set the table width to 100%.
jquery: 1.8.2 jquery ui: 1.9.1 I modified the default way of implementing a jquery
I am working with an SVG that is directly placed into an HTML file
I'm using jQuery button, in particular this example: http://jqueryui.com/button/#splitbutton I've placed this markup incide
I have a property file( actually 100 or more). This is actually placed in
This Question has been modified to show working code. When they click an item
I have placed an ubuntu.img file in a folder on my SD card as

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.