Q:

How to remove an added value by uncheck box?

Hi I have check box to add a value on click. However, It also adds even if I unchecked the box. How can I remove the added value when I uncheck the box? Thank you!
$('.addCheckBox').click( function( event ){
                var btn = $(event.currentTarget);
                var Data = btn.data();
                var addList = $('#ListBtn');

                var Obj = {
                    aID: Data.id,
                    aName: Data.name
                };
                addList.push( Obj );
                addListBtn[0].innerHTML = "(" + addList.length + ") in List";
            });

A:

$('.addCheckBox').click(function (event) {
    if ($('.addCheckBox').is(':checked')) {
        var btn = $(event.currentTarget);
        var Data = btn.data();
        var addList = $('#ListBtn');

        var Obj = {
            aID: Data.id,
            aName: Data.name
        };

        addList.push({"myData":Obj});
        console.log(addList);
    }else{
        var addList = $('#ListBtn');
        addList.remove("myData");
        console.log(addList);
    }
});

