Getting all selected checkboxes in an array
Formatted :
$("input:checkbox[name=type]:checked").each(function(){ yourArray.push($(this).val());});
Hopefully, it will work.
Pure JS
For those who don't want to use jQuery
var array = []var checkboxes = document.querySelectorAll('input[type=checkbox]:checked')for (var i = 0; i < checkboxes.length; i++) { array.push(checkboxes[i].value)}
var chk_arr = document.getElementsByName("chkRights[]");var chklength = chk_arr.length; for(k=0;k< chklength;k++){ chk_arr[k].checked = false;}