Jquery: display div based on the selection from DropDownList -


i have dropdownlist (asp.net) , when user change selection , want display div based on selected dropdownlist.

i have code here...

    <asp:dropdownlist id="ddlfilter" runat="server" width="221px">         <asp:listitem text="select..." value=""></asp:listitem>         <asp:listitem text="date" value="date"></asp:listitem>         <asp:listitem text="subject" value="subject"></asp:listitem>         <asp:listitem text="status" value="status"></asp:listitem>     </asp:dropdownlist>     &nbsp;     <asp:button id="btnsearch" text="search" runat="server" />         <div id="divdaterangesearch">         <div style="float: left">             <asp:label id="lbldaterange" runat="server" text="date range"></asp:label>             <br />             <uc1:datepicker id="fromdate" runat="server"  />             <uc1:datepicker id="todate" runat="server"  />         </div>     </div>       <div id="divsearchsubject" >         <div style="float: left">             <asp:label id="lblsubject" runat="server" text="subject"></asp:label><br />             <asp:textbox id="txtsubject" runat="server" width="225px"></asp:textbox>         </div>     </div>        <div id="divstatussearch">         <div style="float: left">             <asp:label id="lblstatus" runat="server" text="status" ></asp:label>             <br />             <asp:dropdownlist id="ddstatus" runat="server" width="152px" >             </asp:dropdownlist>         </div>     </div> 

updated:

<div  style="width: 880px; padding-top: 2px; border-bottom: none;             height: 28px;">             <asp:label id="lblfilterresultsby" runat="server" text="filter results by:"></asp:label>              <asp:dropdownlist id="ddlfilter" runat="server" width="221px">         <asp:listitem text="select..." value=""></asp:listitem>         <asp:listitem text="date" value="date"></asp:listitem>         <asp:listitem text="subject" value="subject"></asp:listitem>         <asp:listitem text="status" value="status"></asp:listitem>     </asp:dropdownlist>             &nbsp;               <div id="div_date"  style="width:250px; display:none;  "  class="sectionrowdate">                  <div style="float: left">                     <asp:label id="lbldaterange" runat="server" text="date range" ></asp:label>                     <br />                     <uc1:datepicker id="fromdate" runat="server"  />                     <uc1:datepicker id="todate" runat="server"  />                     </div>             </div>              <asp:button id="btnsearch" text="search" runat="server" />   

$('#ddlfilter').change(function(){    var sel = $(this).val();    if(sel === 'date'){      hideall();// function hide divs first      $('#divdaterangesearch').show();    } else if(sel === 'subject'){      ///so on...    } }); 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -