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

The Archive Base Latest Questions

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

Yesterday I have raised the same type of question in a different format. But

  • 0

Yesterday I have raised the same type of question in a different format. But today i want the same question in a different format.

Here it goes:

I have multiple divs in a page.

When i select one value from the drop down and I click the submit button, I need to show the two divs.

Here is my html code :

 <div id="one">
                  <h1>
                    Security
                      <div class="hdrhr" style="width:5%">&nbsp;</div>
                  </h1>
             </div>
             <div id="two"  class="hidden">
                  <h1>
                    Customer Type
                      <div class="hdrhr" style="width:5%">&nbsp;</div>
                  </h1>
             </div>


<form onSubmit="javascript: return false;">
                                    <select name='dropDown' id='dropDown' style="width:205px;padding:4px;margin-left:-2px;">
                                        <option value="one">Security</option>
                                        <option value="two">Customer Type</option>
</select>

Here is the button
Get Details

 <div id="one" class="roundedCorner">
                        <table width="100%" border="0" cellpadding="8" cellspacing="0">
                            <tr>
                            <td align="center" class="parentalhdtlnt" style="color:#ffffff;width:5%">
                               Id_User
                               <br />
                               <input type="text" name="Member" class="ipttxt" tabindex="1" />
                            </td>
</tr>
</table>
</div>
 <div id="two" class="roundedCorner">
                        <table width="100%" border="0" cellpadding="8" cellspacing="0">
                            <tr>
                            <td align="center" class="parentalhdtlnt" style="color:#ffffff;width:5%">
                               Id_User
                               <br />
                               <input type="text" name="Member" class="ipttxt" tabindex="1" />
                            </td>
</tr>
</table>
</div>

Here is my js code

 <script type="text/javascript">
    $(document).ready(function(){
        $("#goBttn").click(function(){
            $("#"+$("#dropDown").val()).show();
            select = document.getElementById("dropDown").getElementsByTagName("option");
            select = document.getElementById("hdrlbl").getElementsByTagName("option");
            for(x=0;x<=select.length;x++)
                if($(select[x]).val()!=$("#dropDown").val()) $("#"+$(select[x]).val()).hide();
                if($(select[x]).val()!=$("#hdrlbl").val()) $("#"+$(select[x]).val()).hide();
        });
    });
</script>

In a drop down if i selecting security i need to show the heading div and as well as content div the same for customer type

Kindly bear me the formatting of the code.

Please help me.

Thanks in advance
SKM

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

    I spent some time restructuring the code as a whole since it looks a bit unorganized to me. Here is the JSFiddle: http://jsfiddle.net/ccw24/

    HTML

    <div class="headerCont switchArea">
        <div data-ref="one">Header One (Security)</div>
        <div data-ref="two">Header Two (Customer Type)</div>
    </div>
    
    <select name='dropDown' id='dropDown'>
        <option value="one">Security</option>
        <option value="two">Customer Type</option>
    </select>
    <a href='#' id="pageChange">Go</a>
    
    <div class="footerCont switchArea">
        <div data-ref="one">Footer One (Security)</div>
        <div data-ref="two">Footer Two (Customer Type)</div>    
    </div>
    

    JS

    $(document).ready(function(){
        $("#pageChange").on('click',function(e){
            e.preventDefault();
            var ref = $('#dropDown').val();
            $('.switchArea > div').hide();
            $('div[data-ref="'+ref+'"]').show();
        });
    });
    

    CSS

    .switchArea > div {
        display: none
    }
    
    .switchArea > div:first-of-type {
        display: block
    }
    

    Just a note: This code uses some more modern techniques that may not work well with older browsers (Old IE, I am looking at you) so if you need compatibility with those browsers then you may need to do some tweaking.

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

Sidebar

Related Questions

Yesterday I have put the question which was answered correctly but now I want
Yesterday I have made paperclip multiple upload gallery. Today I want to customize this
Yesterday I had question (answered), which I have to expand a bit more today.
yesterday I asked question which have been answered correctly. Now I want spend more
I asked a question similar to this yesterday but have changed my code a
i have uploaded an app yesterday by 6pm but till now i can't find
Yesterday I was reading a lot about deploying MacOSX applications, but I still have
I don't know why but since yesterday I have the obj folder that appears
I have posted this problem yesterday..but unfortunately, no one has given me the solution
I have been an avid fan of lazy loading but yesterday I was talking

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.