I have a drop down list with 2 values Default , conditional..
when i select Default in drop down text box is filled with test value
and when i select conditional in drop down text box is empty.
now the prob is when i dont select anything still the text box is with value please help
how do i modify my code..
this is my code
<asp:DropDownList ID="ddlType" runat="server" CssClass="form-control"   AppendDataBoundItems="true" onchange="HideTextBox();" >
       <asp:ListItem Text="Select Type" Value=""></asp:ListItem>
       <asp:ListItem Text="Default" Value="0"></asp:ListItem>
       <asp:ListItem Text="Conditional" Value="1"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txt" runat="server" CssClass="form-control" ></asp:TextBox>
function HideTextBox() {
     //var ControlName = document.getElementById(ddlId.id);
     var ControlName = document.getElementById('<%=ddlType.ClientID%>');
             
     if (ControlName.value == 0) 
     {
         //document.getElementById('<%=txt.ClientID%>').style.display = 'none';
         $('#txt').attr('readonly', 'true').val("TEst");
     }
     else if (ControlName.value == 1 ) 
     {               
         //document.getElementById('<%=txt.ClientID%>').style.display = '';
         $('#txt').removeAttr('readonly').focus().val("");               
     }
     else
     {
         $('#txt').removeAttr('readonly').focus().val("");
     }
}
prob is when i select first default text box is filled with test, and when i go back select type in drop down
text is still filled with text where do i modify it..
I cannot add value to Select type because i am clear my popup values when ever i click it in a function that is below..
help??
function Add() {
     $('#<%=ddlGroups.ClientID%>, #<%=ddlType.ClientID%>,#<%=txt.ClientID%>').val('');
     $('#txt').removeAttr('readonly').focus().val("");
}