52
rated 0 times
[
56]
[
4]
/ answers: 1 / hits: 88095
/ 11 Years ago, sat, september 21, 2013, 12:00:00
I'm trying to get the class of the selected option and use that in a compare statement to find which class it is.
I get an undefined value. The option tag has a class set to it.
Why am I not getting a value back?
Html:
<select name=datagrid_filter onchange=startFilter();>
<option>All</option>
<option disabled=true>Assignment:</option>
<option disabled=true>Client:</option>
<option disabled=true>Type:</option>
<option class=type value=Activity>   Activity</option>
<option class=type value=Alert>   Alert</option>
<option class=type value=Lead>   Lead</option>
<option class=type value=Notification>   Notification</option>
</select>
Javascript:
var cs1 = $(option:selected, this).attr(class);
if(cs1 == 'Type'){
//do something
}
More From » jquery