jqeury[1.9.1] problem : checkbox on/off manipulation

jqeury[1.9.1] problem : checkbox on/off manipulation

(sorry my poor english)

Hi ! 
Always thank you for your efforts.

I have developed some javascript code using jquery 1.9.1.

by the way, i've got some problems.
input tag (checkbox type) manipulation doesn't works well.

<my .js code>
--------------------- bind click event.
var chkbox = $('#chkbox');
var allchk = $('#allchk');

if( allchk.val() == 0 )
{
  chkbox.attr('checked', true);
  allchk.val(1);
}
else
{
  chkbox.attr('checked', false);
  allchk.val(0);
}
--------------------( my purpose is checkbox on/off. )
as a result, that code worked only once. off (init) ----(click)----> on ----(click)----> off ----(click) ---- (no change)

but, this result disappears at jquery 1.8.3.
Please check this problems.

Thanks.