title: jQuery refer to element of the if statement
body: <p>I am trying to filter some elements based on it's data attributes. Here's the code I've written until now:</p>
  <pre><code>$(document).on('change', '.filter-mobile_categories :radio[name=&quot;filterSize&quot;]', function(){
    const size_value = this.value;
    $('.li-product').hide();
    if ($('.li-product').dataset.sizes !== &quot;&quot; &amp;&amp; $('.li-product').dataset.sizes.indexOf('-' + size_value + '-')){
      //refer to those elements
    }
  });
  </code></pre>
  <p>How do I refer to the elements that comply with the if's condition?
  Or using a totally different method like <code>.filter()</code> would be better? If so, how?
  Thanks!</p>