I want to change the visibility of a textbox, according to the value selected in a dropdownlist.
I have created the function like this:
function ShowGiftCardSource() {
var ddlGiftCardSource = document.getElementById('<%=ddlGiftCardSource.ClientID%>');
var txtGiftCardSource = document.getElementById('<%=txtGiftCardSource.ClientID%>');
if (ddlGiftCardSource.value == "Other") {
txtGiftCardSource.style.visibility = "visible";
txtGiftCardSource.focus();
}
}
In the CS Page:
ddlGiftCardSource.Attributes.Add("onChange", "OnSelectedIndexChanged();");
and in the control:
<asp:DropDownList ID="ddlGiftCardSource" runat="server" Width="151px" onChange="ShowGiftCardSource();">
But I'm getting the following error:
Microsoft JScript runtime error: Object expected
Could some one please help me to resolve it?