title: How do I get the class attribute value using jquery and javascript
body: <p>I'm trying to get the class of the selected option and use that in a compare statement to find which class it is.</p>
  
  <p>I get an undefined value. The option tag has a class set to it.</p>
  
  <p>Why am I not getting a value back?</p>
  
  <p>Html:</p>
  
  <pre><code>&lt;select name="datagrid_filter" onchange="startFilter();"&gt;
      &lt;option&gt;All&lt;/option&gt;
      &lt;option disabled="true"&gt;Assignment:&lt;/option&gt;
      &lt;option disabled="true"&gt;Client:&lt;/option&gt;
      &lt;option disabled="true"&gt;Type:&lt;/option&gt;
      &lt;option class="type" value="Activity"&gt; &amp;nbsp Activity&lt;/option&gt;
      &lt;option class="type" value="Alert"&gt; &amp;nbsp Alert&lt;/option&gt;
      &lt;option class="type" value="Lead"&gt; &amp;nbsp Lead&lt;/option&gt;
      &lt;option class="type" value="Notification"&gt; &amp;nbsp Notification&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>var cs1 = $("option:selected", this).attr("class");
  if(cs1 == 'Type'){
      //do something
  }
  </code></pre>