mercredi 2 septembre 2015

jQuery on check, add or update array object item

I have a series of checkboxs and on change event like so:

$(".checkbox").on('change', function () {
          UpdateHolder($(this).attr('id'), customerID, this.checked);
});


function UpdateHolder(questionid, customerid, checked) {
        holder.push({ questionid: questionid, customerid: customerid, checked: checked });
        console.log(holder);
    }

with this, I am able to add an item to the array, but my question is how would I update an item ? I only want to update if a checkbox is selected or not.




Aucun commentaire:

Enregistrer un commentaire