How do I get the class attribute value using jquery and javascript
You should change:
onchange="startFilter();"
to onchange="startFilter(this);"
and in startFilter function:
function startFilter(ele){
var className = $("option:selected", ele).attr("class");
if(className == 'type'){
//do something
}
}
Take note that, the this
inside startFilter function refers to the window
object, not the element you bind it to.