title: Why is my this.class always undefined with jQuery filter?
body: <p>I am trying to get all the div elements with classes having a name containing print. I am trying to achieve this like so:    </p>
  
  <pre><code>const matchedContainer = [];
      $('div').filter(() =&gt; {
          regex = new RegExp("\w*print\w*","i");
          if( this.class !== undefined &amp;&amp; this.class.match(regex)) {
              var elementContents = $(this).prop('outerHTML'); 
              matchedContainer.push(elementContents);
          }
      }
  </code></pre>
  
  <p>Here I am never able to enter the if loop as this.class is always equated to undefined. I also tried with ".each" instead of ".filter" with the same result. I also tried giving names to each element by ".filter((ind,elem)=>{...})" and then tried using elem.class but that didn't work as well.</p>
  
  <p>I tried a similar approach with this.id and that worked fine, can anyone tell me as to what I am doing wrong?</p>