jquery-1.9.1.min.js is not working with

jquery-1.9.1.min.js is not working with

I have a snippet

  1. <script type="text/javascript">
  2. $(function(){
  3.     $("#selectall").click(function(){
  4.         $('.mycheckbox').attr('checked',this.checked);                          
  5.     });       
  6. });
  7. </script>
  1. <ul>
  2.     <li><label><input type="checkbox" id="selectall" /> Select All</label></li>
  3.     <li><label><input type="checkbox" name="1" class="mycheckbox" /> 1</label></li>
  4.     <li><label><input type="checkbox" name="2" class="mycheckbox" /> 2</label></li>
  5.     <li><label><input type="checkbox" name="3" class="mycheckbox" /> 3</label></li>
  6.     <li><label><input type="checkbox" name="4" class="mycheckbox" /> 4</label></li>
  7.     <li><label><input type="checkbox" name="5" class="mycheckbox" /> 5</label></li>
  8. </ul>
which works well in older version of jQuery Lib. But with latest version 1.9.1, for once its works well, and continue clicking, it stops working.

Could anyone explain this to me please ?