Does anyone know how can I get the ID and class name from the dropdown box in jquery? I have been using the following code
var my_array = array[];
$("input[class^=map]").each(function(index, element) {
my_array.push(this.id + "-" + this.className);
});
to get the ID and class name from the following code. This is working fine for TextBox but not dropdown box. Does anyone know what is it going on here? and how can I solve this issue?
<asp:TextBox ID="test" runat="server" MaxLength="12" Width="3em" CssClass="mapTest" />
<asp:DropDownList ID="test1" runat="server" DataSourceID="dsTestType" CssClass="maptest1"
DataValueField="test_code" DataTextField="test_desc" AppendDataBoundItems="true" >
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
I would like the end result be like this:
my_array[0] = test-maptest
my_array[1] = test1-maptest1
try