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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:24:42+00:00 2026-05-29T16:24:42+00:00

For some reason jquery’s .hide() won’t hide a div that contains a file input

  • 0

For some reason jquery’s .hide() won’t hide a div that contains a file input after a file has been selected. When no file is selected, I can run the js and hide it. See example below:

<script type="text/javascript">
function upload_1(ele){

 ele.form.submit();

 $( "#div_1" ).hide('clip', {}, 'fast');
 $( "#waiting_1" ).show('clip', {}, 'fast');
}
</script>
<div id="div_1" class="ajaxVisible" style="float: left;" >
    <form method="post" action="action.php" enctype="multipart/form-data" id="form_1" target="hiddenIFrame1" >
        <input type="file" name="file" size="1" onchange="upload_1(this);" id="image_1" />
    </form>
    </div>
    <iframe style="width:0px;height:0px;border:0px;" name="hiddenIFrame1"></iframe>
    <div id="waiting_1"  style="display: none; float: left;">
<center><img src="abc.gif" height="15px" /></center>
</div>

Here is the code I use to test when no file is selected:

function ajaxHide() {

   $( "#div_1" ).hide('clip', {}, 'fast');
   $( "#waiting_1" ).show('clip', {}, 'fast');
   }

and I have a button:

<button onclick="ajaxHide();">Hide</button>

Again, I can click the button above to test with no file selected, div hides perfectly. When I run the actual use case and select a file, it doesn’t hide it after one is selected, but the hidden waiting div does show as it should.

Thanks for the help!

  • 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-29T16:24:43+00:00Added an answer on May 29, 2026 at 4:24 pm

    I’ve played a little bit with your code and found the following issue:

    code in upload_1 maybe works incorrectly (I mean probably here is infinite loop because as soon as code tries to hide div it leads onchange is fired again)

    Everything works good as soon as I remove this code from upload handler everything works good:

    $("#div_1").hide('clip', {}, 'fast');
    $("#waiting_1").show('clip', {}, 'fast');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am trying to remove a div inserted by jquery onclick. for some reason its
For some reason jQuery won't load on my website. I've tried it in google
I have a problem with jQuery, for some reason, that code makes infinite loop:
I've been reading the documentation of a jQuery Validation Plugin and for some reason
For some reason, jQuery isn't loading my php file. The button is clicked and
For some reason jQuery.addClass has stoped working. I have no idea why. Other stuff
I have a django project, but for some reason basic jquery isn't working. <html>
I'm fairly new to JQuery and for some reason I can't get the currently
I'm developing a site using jQuery, and jQuery UI tabs. For some reason, my
I am using Javascript-JQuery to submit 2 aspx pages, $('#MyForm1').submit(); $('#MyForm2').submit(); for some reason

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.