title: JS closest/parent not working on loaded page
body: <p>I'm working with a third-party code and I'm quite limited in terms of filtering a list of elements.</p>
  <p>Each of these elements has this structure:</p>
  <pre><code>&lt;div class=&quot;item-preview&quot;&gt;
     &lt;div class=&quot;item-info&quot;&gt;
        &lt;div class=&quot;tag&quot;&gt;
           &lt;svg class=&quot;tag-public&quot;&gt;&lt;/svg&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>The only thing that changes is the svg class, so it's whether tag-public or tag-private. Depending on the user type that's checking the content, I'd like to hide it when it's <code>tag-private</code>. I've tried this:</p>
  <pre><code>$('.tag-private').closest('.item-preview').hide();
  </code></pre>
  <p>And this:</p>
  <pre><code>$('.tag-private').parents('.item-preview').hide();
  </code></pre>
  <p>But any of them works. The code uses React and the items are brought by JSON/AJAX, so I guess the problem is related to trying to modify the page once is loaded...</p>
  <p>Any thoughts on how to make my JS &quot;override&quot; the original code? Thanks a ton.</p>