var CustomerIDArray=[];
$(document).ready(function () {
$(".checkBoxClass").click(function (e) {
var arr=CustomerIDArray;
var checkedId=$(this).attr('id');
if($(this).prop('checked')){
CustomerIDArray.push(checkedId);
arr=CustomerIDArray;
}
else
{
jQuery.each(CustomerIDArray,function(i,item){
if(arr[i] == checkedId) {
arr.splice(i, 1);
}
});
CustomerIDArray =arr;
}
var ids="";
jQuery.each(CustomerIDArray,function(i,item){
if(ids=="")
{
ids= CustomerIDArray[i];
}
else
{
ids= ids+ ","+ CustomerIDArray[i];
}
});
alert(ids);
});
});