title: How to hide a table row or result if checkbox is checked AND if 0 result/count
body: <p>I have this counter for word occurrence in the textarea. The problem is, I have a lot of items in the table, and so it can be distracting to include the zero results.</p>
  <p>So what I'm hoping to achieve is, if the user checks the checkbox, it will not show the zero results anymore (preferably the whole row)..</p>
  <p>Please see the code so far:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let textarea = $('#textarea3');
  textarea.on('keyup', _ =&gt; counting());
  function counting() {
      var searchText = $('#textarea3').val();
  
      let words = [];
      words['1 sample'] = '#one';
      words['2 sample'] = '#two';
      words['3 sample'] = '#three';
      words['4 sample'] = '#four';
      words['5 sample'] = '#five';
      words['6 sample'] = '#six';
  
      for (const word in words) {
          var outputDiv = $(words[word]);
          outputDiv.empty();
          let count = searchText.split(word).length - 1;
          searchText = searchText.replaceAll(word,'');
          outputDiv.append('&lt;a&gt;' + count + '&lt;/a&gt;');
      }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
  &lt;input type="checkbox"&gt;
  &lt;label&gt; Don't show zero results&lt;/label&gt;&lt;br&gt;
  &lt;button onclick="counting();"&gt;Count&lt;/button&gt;
  
  &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th scope="col"&gt;Items&lt;/th&gt;
              &lt;th scope="col"&gt;Count&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;1 sample&lt;/td&gt;
              &lt;td&gt;&lt;a id="one"&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;2 sample&lt;/td&gt;
              &lt;td&gt;&lt;a id="two"&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;3 sample&lt;/td&gt;
              &lt;td&gt;&lt;a id="three"&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;4 sample&lt;/td&gt;
              &lt;td&gt;&lt;a id="four"&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;5 sample&lt;/td&gt;
              &lt;td&gt;&lt;a id="five"&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;6 sample&lt;/td&gt;
             &lt;td&gt;&lt;a id="six"&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;textarea id="textarea3" rows="5"&gt;
  1 sample
  2 sample
  3 sample
  5 sample
  &lt;/textarea&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>If the checkbox isn't checked, it should function as is and still show all results.</p>
  <p>I've seen this post but I'm not really sure how to implement it to my own project. <a href="https://stackoverflow.com/questions/27621174/show-or-hide-table-row-if-checkbox-is-checked">Show or hide table row if checkbox is checked</a></p>
  <p>Thank you in advance for any help.</p>