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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:27:43+00:00 2026-05-30T21:27:43+00:00

I am working on a form which has a small part that hides and

  • 0

I am working on a form which has a small part that hides and shows a div then submits to a page. My problem is that when I hide the div and submit, then click the back button, the div is not hidden. Here is my code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
    <script type="text/javascript" src="http://nix.lv/history/jquery-1.2.3.min.js"></script>
    <script type="text/javascript">

        jQuery(document).ready(function ($) {

            $('#Contact').change(function () {
                if ($(this).val() == ('Yes')) { $('#sentBy').show(); }
                else { $('#sentBy').hide(); }
            });

        });
</script>
</head>

<body>
<form method="post" action="http://google.com">
<div><p><label for="Contact">Want an answer? </label><br />
                    <select size="1" name="Contact" id="Contact" onchange="toggle('hide', 'sentBy');">
                        <option value="Yes" selected="selected">Yes</option>
                        <option value="No">No</option>
                    </select></p>
                    </div>
    <div id="sentBy">
        this is a test
    </div>
    <input type="submit" value="wow"/>
 </form>
</body>
</html>
  • 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-30T21:27:44+00:00Added an answer on May 30, 2026 at 9:27 pm

    On document ready, check the value of the dropdown and hide the div if appropriate. Try this edit:

    jQuery(document).ready(function ($) {
    
            var shouldHideDiv = $('#Contact').val() != 'Yes';
            if (shouldHideDiv) {
                $('#sentBy').hide();
            }
    
            $('#Contact').change(function () {
                if ($(this).val() == ('Yes')) { $('#sentBy').show(); }
                else { $('#sentBy').hide(); }
            });
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small page which has label, DropDownList and a submit button. <div> <asp:label
I am working on a .NET C# application that has a main Form which
I have a form which I am working on that has 3 choices of
I have an enquiry form on a site, which has been working for a
I m working on django view.I m posting a form which has a param
i have form that has multiple input text boxes, Which has got some text
I am currently working on an Android application which has an order form. I
I am working on a page, which has a link which reads update. When
I am building a small application in RoR that has a form asking for
I have a small app where the index page is a form that instructs

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.