title: When I will click on a href link it will check all checkbox after related this link
body: <p>I have a links named <code>All</code> and <code>none</code>. When I click on <code>All</code>, I want it to check all checkboxes related with it and change it's link text to <code>none</code>. </p>
  
  <p>When I click again I want it to uncheck all of the checkboxes. </p>
  
  <p>I have some code which I can use to check all boxes with a checkbox. But now I want to check all boxes with a link. Please see, here is this demo code (<a href="http://jsfiddle.net/kdEmH/24/" rel="nofollow">also on jsfiddle</a>):</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
      $(function(){
  
      // add multiple select / deselect functionality
      $("#selectall").click(function () {
            $('.case').attr('checked', this.checked);
      });
  
      // if all checkbox are selected, check the selectall checkbox
      // and viceversa
      $(".case").click(function(){
  
          if($(".case").length == $(".case:checked").length) {
              $("#selectall").attr("checked", "checked");
          } else {
              $("#selectall").removeAttr("checked");
          }
  
      });
  });
        $(document).ready(function () {
          $("input[type=checkbox]").click(updateCount);
  
          updateCount();
  
          function updateCount () {
            var count = $("input[type=checkbox].case:checked").length;
  
            $("#count").text(count);
            $("#status").toggle(count &gt; 0);
          };
        });
      &lt;/script&gt;enter code here
    &lt;/head&gt;
    &lt;body&gt;
      &lt;H2&gt;why counting wrong in crome, Ie &lt;/H2&gt;
  
  select all
      &lt;input type="checkbox" id="selectall"/&gt;
      &lt;input type="checkbox" class="case" name="case" value="1"/&gt;
      &lt;input type="checkbox" class="case" name="case" value="2"/&gt;
      &lt;input type="checkbox" class="case" name="case" value="3"/&gt;
      &lt;input type="checkbox" class="case" name="case" value="4"/&gt;
      &lt;input type="checkbox" class="case" name="case" value="5"/&gt;
      &lt;div id="status"&gt;
        &lt;p id="count"&gt;0&lt;/p&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  
  
  
  
  http://jsfiddle.net/kdEmH/24/
  </code></pre>