Solved

I need help with a JQuery funtion in my ASP.Net application

Posted on 2011-09-26
2
201 Views
Last Modified: 2012-05-12
Hi Experts,
I have written the following JQuery function in my ASP.Net app to display a panel when the value from a DropDownList control changes.  I need to now hide the panel if the value selected = NONE. Do I have to use the DropDownList SelectedItem or SelectedValue. How do I modify the JQuery function below to do this?  

Thanks in advance.
mrotor



    $(function() {
    $("select[id$=ddlDisablityCode_Edit]").change(function() {
            $("div[id$=PnlSPEDInfo]").show();
            $("div[id$=PnlInitialIEPInfo]").show();
            $("div[id$=PnlSemisInfantInfo]").show();
        });
    });
0
Comment
Question by:mainrotor
  • 2
2 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36602611
The value of the option is NONE ! <option value="NONE">HELLO</option>
$(function() {
    $("select[id$=ddlDisablityCode_Edit]").change(function() {
if( $("option:selected",this).val() == "NONE" ) {
            $("div[id$=PnlSPEDInfo]").hide();
            $("div[id$=PnlInitialIEPInfo]").hide();
            $("div[id$=PnlSemisInfantInfo]").hide();
}
else {
            $("div[id$=PnlSPEDInfo]").show();
            $("div[id$=PnlInitialIEPInfo]").show();
            $("div[id$=PnlSemisInfantInfo]").show();
}
        });
    });

Open in new window

0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36602612
The text of the option is NONE : <option value="HELLO">NONE</option>
$(function() {
    $("select[id$=ddlDisablityCode_Edit]").change(function() {
if( $("option:selected",this).text() == "NONE" ) {
            $("div[id$=PnlSPEDInfo]").hide();
            $("div[id$=PnlInitialIEPInfo]").hide();
            $("div[id$=PnlSemisInfantInfo]").hide();
}
else {
            $("div[id$=PnlSPEDInfo]").show();
            $("div[id$=PnlInitialIEPInfo]").show();
            $("div[id$=PnlSemisInfantInfo]").show();
}
        });
    });

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Full Screen problem when auto scale IFRAME 2 64
Regular Expression Calculator Tester 2 57
Apply tab index in forms 6 33
Sorting a string 1 10
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now