Problem with change checkbox status more than 2 times under jquery 9+

Today I got a problem with the checkbox. I wrote a very simple select all/deselect all feathers with jquey. something like that:

$('.mycheck').attr("checked", checked); //select all

and

$('.mycheck').removeAttr('checked'); // deselect all

The Problem is, the code work only once. After the second time,the checkbox will not be checked, even if a attriube „checked“ is already attached in DOM.

So I found the post in stackoverlfow: http://stackoverflow.com/questions/14494467/jquery-1-9-checkbox-not-checked-second-time-after-once-it-unchecked

use

$("#add_cart_checkbox").prop("checked", true) ;

has solved the problem.