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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:02:23+00:00 2026-06-07T00:02:23+00:00

<html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js> </script> <script type=text/javascript> $(function () {

  • 0
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js">
</script>

<script type="text/javascript">
   $(function () {
    $('select[id$=ddlCardType]').change(function () {
        if (this.value == -1) {
            $('div[id$=Panel1]').show();
            $('div[id$=Panel2]').hide();
        }
        else {
            $('div[id$=Panel1]').hide();
            $('div[id$=Panel2]').show();
        }
    });

});
</script>

</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
    <asp:ListItem Text="Select" Value="-1" />
    <asp:ListItem Value="1" Text="Text1" />
    <asp:ListItem Value="2" Text="Text2" />
    <asp:ListItem Value="3" Text="Text3" />
    <asp:ListItem Value="4" Text="Text4" />
    <asp:ListItem Value="5" Text="Text5" />
</asp:DropDownList>
<asp:Panel ID="Panel1" runat="server" Style="display: none;">
    Lorem Ipsum Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum
</asp:Panel>
<asp:Panel ID="Panel1" runat="server" Style="display: none;">
    This si panel 2
</asp:Panel>

</form>
</body>
</html>

The above written code is not working when page is loaded for the first time.
i.e
When when page is loaded for the first time Panel1 should be visible.
But it’s not happening.
Only after you do changes in drop down it’s working correctly.

Please advice.

  • 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-07T00:02:24+00:00Added an answer on June 7, 2026 at 12:02 am

    Remove this:

    Style="display: none;"
    

    The select is hidden until the change event is executed. If you of some reason need the display:hidden in the style, you can change your javascript instead:

    $(function() {
        $('select[id$=DropDownList1]').change(function() {
            if (this.value == -1) {
                $('div[id$=Panel1]').show();
            }
        }).change();
    
    });
    

    it will simply execute the change event when page is loaded.

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

Sidebar

Related Questions

Here is my code <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script type=text/javascript src=<%= ResolveUrl(Scripts/jquery-1.3.2.min.js) %>></script>
I have the following code: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script src=http://code.jquery.com/jquery-1.4.4.min.js></script> <script type=text/javascript
<html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title>System Toolbox</title> <script src=../../Scripts/jquery-1.3.2.js type=text/javascript /> <script type=text/javascript> $document.ready(function()
I have a form as under <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title>Untitled Page</title> <script type=text/javascript
Here is a simplified version of my page: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script
<html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> </head> <body> <form id=form1 runat=server> <div> <input id=inpHide type=hidden
I have the following HTML <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <style> .box {
I have the following ASPX page: <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <script src=js/jquery-1.2.6.min.js
Please see the HTML below: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <style type=text/css> html, body
I have the following HTML/ASP.NET code: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title>Ny test</title> <link rel=stylesheet

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.