function checkAll(){ $("input[name='choseAll']").click(function(){ $("input[class='cartBox'][type='checkbox']").attr("checked",$(this).attr("checked")); }); }