jeudi 19 mai 2016

Push array of checkbox values to hidden field

I am running this code and it returns me set of values which are checked

var a = [];
var cboxes = $('input[name="suppcheck[]"]:checked');
    var len = cboxes.length;
    for (var i=0; i<len; i++) {
        a[i] = cboxes[i].value;
       //document.getElementByName('suppgrp[]').value = a[i];

    }

I have a hidden field with ID suppgrp where I want to push all these values retrieved and wanted to pass it in array..

But I am not able to...where am I going wrong?




Aucun commentaire:

Enregistrer un commentaire