title: A checkbox to select / unselect them all
body: <p>I want to create a checkbox that will have the "power" to check / uncheck a checkboxfor for each items presents in a list.</p>
  
  <p>Here is part of the view as I built it right now (please bear with the false names and convention):</p>
  
  <pre><code>    &lt;p&gt;
          @using (Html.BeginForm("SendObj", "Manager"))
          {
              &lt;p&gt;
                 Select / UnSelet All Items @Html.CheckBox("selectAll", true) 
              &lt;/p&gt;
              &lt;table id="objToSend"&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Obj Name&lt;/th&gt;
                      &lt;th&gt;Number In Stock&lt;/th&gt;
                      (...)
                  &lt;/tr&gt;
                  @for (int i = 0; i &lt; Model.Count(); i++)
                  {
                      &lt;tr&gt;
                          &lt;td&gt;@Html.DisplayFor(x =&gt; x[i].m_OthObj.m_ObjName)&lt;/td&gt;
                          &lt;td&gt;@Html.DisplayFor(x =&gt; x[i].m_NbInStock)@Html.HiddenFor(x =&gt; x[i].m_NbInStock)&lt;/td&gt;
                          (...)
                      &lt;div id="divChckBox"&gt;
                          &lt;td&gt;
                              @Html.CheckBoxFor(x =&gt; x[i].m_IsSelected)
                          &lt;/td&gt;
                      &lt;/div&gt;
  
                      &lt;/tr&gt;
                  }
  
              &lt;/table&gt;
              &lt;input type="submit" value="Send"/&gt;
          }
      &lt;/p&gt;
  </code></pre>
  
  <p>As for the "how", well, I have searched a bit around and I have tried this jquery script, but to no avail:</p>
  
  <pre><code>    **** EDIT ****
  </code></pre>
  
  <p>Here's a new jQuery based on the comments people posted below. The alerts are there on debug purpose, and both appears when needed:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          alert("The document is ready");
          $("#selectAll").click(function() {
              alert("The case has been clicked");
              var chkValue = $(this).is(":checked");
              $("#divChckBox").attr("checked", "checked");
          });
      });
      &lt;/script&gt;
  </code></pre>
  
  <p>I do not mind using jquery, far from it, I just do not know how it works yet. Maybe that's why what I have in mind does not work.</p>
  
  <p>Can anyone help me out? Thank you!</p>
  
  <p><strong>* EDIT *</strong></p>
  
  <p>I will add here what the rendered page gives out for the checkboxes:</p>
  
  <pre><code>&lt;td&gt;&lt;input checked="checked" class="chckBoxList" data-val="true" data-val-required="The m_IsSelected field is required." name="[0].m_IsSelected" type="checkbox" value="true" /&gt;&lt;input name="[0].m_IsSelected" type="hidden" value="false" /&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Maybe that will give out more informations on what's going on.</p>