title: Jquery Negation
body: <p>I am trying to hide items from an unordered list. This code works for some sites under SharePoint, but not for others.</p>
  <p>On sites where it works, it has 4 items under the <code>ul</code> and in sites where it's not working has 3 items under the <code>ul</code>.</p>
  <pre class="lang-js prettyprint-override"><code>public componentDidMount() {
    var endpointUrl = this.props.context.pageContext.web.absoluteUrl + &quot;/_api/web/currentuser/?$expand=groups&quot;;
  
    $.ajax({
      url: endpointUrl,
      method: &quot;GET&quot;,
      async: false,
      contentType: &quot;application/json;odata=verbose&quot;,
      headers: {
        Accept: &quot;application/json;odata=verbose&quot;,
      },
      success: function(data) {
        var allowedgroups = [&quot;Checking_External_User&quot;];
        var userGroups = data.d.Groups.results;
        var foundGroups = userGroups.filter(function(g) {
          return allowedgroups.indexOf(g.LoginName) &gt; -1;
        });
        if (foundGroups.length == 0) {
          $(&quot;#linkUL li:not(:first)&quot;).hide();
        }
      },
    });
  </code></pre>
  <p>Html:</p>
  <pre><code>&lt;div class=&quot;subsite-wrapper&quot;&gt;&lt;h3 class=&quot;subsite-title&quot;&gt;Site Links&lt;/h3&gt;&lt;ul id=&quot;linkUL&quot; class=&quot;subsite-link-list full-width-link&quot;&gt;
  &lt;li&gt;&lt;a target=&quot;_blank&quot; data-interception=&quot;off&quot; href=&quot;&quot;&gt;
  &lt;i class=&quot;fa fa-link&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
  &lt;span id=&quot;gotoDefaultPage&quot;&gt;Quarry Services Handbook&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a target=&quot;_blank&quot; href=&quot;&quot; data-interception=&quot;off&quot;&gt;
  &lt;i class=&quot;fa fa-link&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
  &lt;span&gt;Miscellaneous&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a target=&quot;_blank&quot; href=&quot;&quot; data-interception=&quot;off&quot;&gt;
  &lt;i class=&quot;fa fa-link&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
  &lt;span&gt;Forms&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
  </code></pre>