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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:54:25+00:00 2026-06-09T06:54:25+00:00

I have two div elements that are hidden on $(document).ready(function(){} and they are supposed

  • 0

I have two div elements that are hidden on $(document).ready(function(){} and they are supposed to appear if their specific check box is checked, and disappear if it was checked and then unchecked. I can show the element when the checkbox is selected very easily using show() or slideDown() but when i use the if else statements it returns as false everytime and the forms stay hidden…

$(document).ready(function(){
        if($("#upload_yes").is(':checked')) {
            $("#upload_form").show();
        } else {
            $("#upload_form").hide();
        }

        if($("#new_info_yes").is(':checked')) {
                $("#new_info_form").slideDown(500);
        } else {
                $("#new_info_form").hide();
        }   
    }); 
  • 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-09T06:54:26+00:00Added an answer on June 9, 2026 at 6:54 am

    See this fiddle

    You must do the job in the change event.

    then calling .trigger('change') on the check boxes make the div show/hide on the initial page load.

    The code :

    $(document).ready(function(){
    
        $('input#upload_yes').change(function(){
            if($(this).is(':checked')) {
                $("#upload_form").show();
            } else {
                $("#upload_form").hide();
            }
        });
    
        $('input#new_info_yes').change(function(){
             if($(this).is(':checked')) {
                    $("#new_info_form").slideDown(500);
            } else {
                    $("#new_info_form").hide();
            }   
        });
    
        //Trigger the change event so the divs are initially shown or hidden.
        $('input[type=checkbox]').trigger('change');
    
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two div elements that are twins (i.e. their dimensions and contents are
I have a situation that i have a hidden div with two input elements
I have two div elements, one is the left panel, that is hidden, and
I have two <div> elements that I want to position side by side like
I have two absolutely positioned div elements that overlap. Both have set z-index values
I have a set of HTML reports that each contain two DIV elements with
I have two different div elements on two different webpages that use two different
I have two div -elements, the top one has the height of 40% and
I have hidden Divs with .display-link classes that are two levels up from an
I have some page elements which are meant to appear in a two column

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.