title: Looping through a datatable using JQuery
body: <p>Hi I'm very new to Javascript, when I click a button I want to loop through my datatable looking for checkbox values of true, when a true value is found I want to pass the Id from the row and text from an input field to a method in my controller as parameters.</p>
  <p>I've been trying something like this (Javascript Code below) but I just can't get it working and I have no idea if my loop function is running. Could someone please help me figure this out?</p>
  <p><strong>HTML for button</strong></p>
  <pre><code>&lt;form method=&quot;post&quot; style=&quot;margin-bottom: 41px&quot;&gt;
      &lt;input class=&quot;btn btn-primary text-warning&quot; value=&quot;Extend Selected Licenses&quot; type=&quot;submit&quot; onclick=&quot;loopGrid&quot; id=&quot;btnExtendSelectedLicense&quot;&gt;&lt;/input&gt;
      &lt;input class=&quot;form-control&quot; id=&quot;NumberOfDaysExtended&quot; type=&quot;number&quot; style=&quot;height: 30px; width: 100px; margin-left: 216px; margin-top: -41px&quot;&gt;
  &lt;/form&gt;
  </code></pre>
  <p><strong>HTML for checkbox</strong></p>
  <pre><code>&lt;td&gt; 
      &lt;input class=&quot;form-check-input bg-light&quot; id=&quot;SelectedLicenses&quot; type=&quot;checkbox&quot;&gt;
  &lt;/td&gt;
  </code></pre>
  <p><strong>JQuery script for loop function</strong></p>
  <pre><code>function loopGrid {
      var table = document.getElementById(&quot;CustomerLicensingTable&quot;);
      for (i = 0; i &lt; tr.length; i++) {
          td = tr[i].getElementsByTagName(&quot;td&quot;)[0];
          if (td) {
              SelectedLicenses == true
              //call method
              console.log(&quot;found a true value&quot;)
          } else {
                  tr[i].style.display = &quot;none&quot;;
              }
          }
      }
  }
  </code></pre>