title: Selecting a checkbox in html table containing handlebar, expressjs
body: <p>I have a html table in a form in which the rows of table are populated using handebars. I want to select some rows of the table using checkbox. The form makes a post request. I am using express.js framework for the same. The requiremment is that when the form is submitted the json should have a field named 'checked' which should have value true or 1 if the row was selected. Please help me in solving the issue.</p>
  
  <p><strong>Following is the snippet of the html</strong></p>
  
  <pre><code> &lt;form  id='form1'&gt;
  
  &lt;table border="1"&gt;
  
  {{#each ElectrnicsResults}}
      &lt;tr&gt;
              &lt;td&gt;{{Product}}&lt;/td&gt;
              &lt;td&gt;{{Description}}&lt;/td&gt;
              &lt;td&gt;{{price}}&lt;/td&gt;
              &lt;td&gt;{{quantity}}&lt;/td&gt;
              &lt;td&gt;
            &lt;input type='checkbox' id="check"&gt;
              &lt;/td&gt;
              &lt;td style="display:none"&gt;
                      &lt;input type="hidden" name="electronicsId" value="{{electronicsId}}" /&gt;
                      &lt;input type="hidden" name="Product" value="{{Product}}" /&gt;
                      &lt;input type="hidden" name="Description" value="{{Description}}" /&gt;
                      &lt;input type="hidden" name="price" value="{{price}}" /&gt;
                      &lt;input type="hidden" name="quantity" value="{{quantity}}" /&gt;
                  &lt;/td&gt;
  
  
      &lt;/tr&gt;
  {{/each}}
  
  &lt;/table&gt;
  &lt;input type="submit" value="submit" &gt;
  
   &lt;/form&gt;
  </code></pre>
  
  <p><strong>Following is the javascript code using JQuery</strong></p>
  
  <pre><code>$(document).ready(function () {
      $('#form1').submit(function() {
          $.ajax({
              url: '/submitValues',
              type: 'post',
              dataType: 'json',
              data: $('#form1').serialize(),
              success: function() {
                 alert("Submitted!"); // for testing
              }
          });
          return false;
      });
  
  
  });
  </code></pre>