title: Jquery - Read all Classes from a div
body: <p>I'm trying to read all class names from HTML element in the following way. But it doesn't work:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="test" class="fff aaa ccc" &gt;hello world&lt;/div&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>if ($('#test').attr('class') != '')
  {
     // Read classes
      var all_classes = $('#test').attr('class');
  
      // Output
      $('body').append('Classnames: '+all_classes+' ');
  
  }
  </code></pre>
  
  <p><strong>Example</strong>
  <a href="http://www.jsfiddle.net/AQgqU/8/" rel="nofollow noreferrer">http://www.jsfiddle.net/AQgqU/8/</a></p>
  
  <p>Can somebody help me?</p>