title: jquery set all checkbox checked
body: <p>I am using jquery 1.11.1 and this is my code:</p>
  
  <pre><code>$("#rowchkall").change(function(){
      if($(this).is(':checked')){
          $("input:checkbox[class=rowchk]").each(function() {
              alert("set checked");
              $(this).attr('checked', "checked");
          });
      }else{
          $("input:checkbox[class=rowchk]").each(function() {
              $(this).attr('checked', false);
          });
      } 
  });
  </code></pre>
  
  <p>When I first click on <code>#rowchkall</code>, all the checkbox is set to checked. When I click it again, all checkbox is unchecked. </p>
  
  <p>When I click it again, alert box still appear but none of the checkbox will be checked. Why is it only work for first time only? How can I fix it?</p>
  
  <p>Thank you.</p>