My asp controls:
<asp:TextBox ID="txtCustomer" runat="server" width="54%" onchange="return info();"> </asp:TextBox>
<asp:HiddenField ID="hdn" runat="server" />
<asp:DropDownList ID="ddlrNo" runat="server">
</asp:DropDownList>
My javascript function:
function info() {
var ss = document.getElementById(hdn);
var ss1 = document.getElementById(ddlrNo);
var str = ss.value
var arr = str.split("~");
alert(arr[0])
for (var i = 0; i < arr.length; i++) {
ss1.selectedIndex = 0
ss1.options[0].text = arr[0];
}
}
I have a textbox on which i have to call javascript function,to get value from hidden field to populate dropdown value based on that hidden filed.
but it is not working what is wrong with the code.