jquery asp.net combo box question
Posted
by coson
on Stack Overflow
See other posts from Stack Overflow
or by coson
Published on 2010-04-30T21:07:37Z
Indexed on
2010/04/30
21:17 UTC
Read the original article
Hit count: 163
jQuery
Good Day,
I have a small form with a combo box (ASP.NET Drop Down List control) and a text box (with a DIV id txtName). When the selected index of the combo box changes, I want to clear out the text box.
I understand that:
$("#txtName").val(''); clears the text box value
The thing is the combo box. It contains a list of integers representing the months of the year. The drop down control is called ddlMonths.
$("#ddlMonths").change(function() {
$("#txtName").val('');
});
I thought by using change, an onSelectedIndexChange event handler would be associated with this control.
I also tried (because I've ran into the client id being mangled in ASP.NET w/ jQuery) this:
$("#<%=ddlMonths.ClientID%>").change(function() {
$("#<%=txtName.ClientID%>").val('');
});
and neither approach seems to be working. Am I missing something?
TIA,
coson
© Stack Overflow or respective owner