title: jQuery - How to print class name
body: <p>This my example of my situation,I have a menu that using same class and want to print out name of class.</p>
  
  <pre><code>&lt;a href="#" class="top" onClick="test()"&gt;Home&lt;/a&gt; 
  &lt;a href="#" class="top" onClick="test()"&gt;Profile&lt;/a&gt; 
  &lt;a href="#" class="top" onClick="test()"&gt;background&lt;/a&gt;
  </code></pre>
  
  <p>Here I have tried to create a function but can't work. <br/>
  The expected result will show "top selected"</p>
  
  <pre><code>function test(){
   var getClass = $(this).find('.top'); 
   if(getClass=='top'){
     alert(getClass +'selected');
    }
  }
  </code></pre>