title: jquery addClass not working: "property or method addClass not supported"
body: <p>I got this javascript working</p>
  
  <pre><code>$(".mail-tile").click(function () {
      var idMessage = $(this).attr('data-message-id');
      $('.mail-tile').removeClass(classeEvidenzaRigaSelezionata);
      $(this).addClass(classeEvidenzaRigaSelezionata);
      previewMail(this);        
  });
  </code></pre>
  
  <p>then, in the same page, same js file, I've got this javascript:</p>
  
  <pre><code>function selectMail(idMail) {
      var mailTile = $('.mail-tile[data-message-id="' + idMail + '"]')[0];    
      $('.mail-tile').removeClass(classeEvidenzaRigaSelezionata);
      mailTile.addClass(classeEvidenzaRigaSelezionata);
      previewMail(mailTile);
  }
  </code></pre>
  
  <p>In this case, the addClass function doesn't work: "property or method addClass not supported".</p>
  
  <p><code>classeEvidenzaRigaSelezionata</code> is a global variable.</p>
  
  <p>I can't understand what's the difference between the two snippet. In both case I got an HtmlDivElement to work with (the object is not null).
  What's going on here?</p>