I am trying to create a check box with some value and then display the values of selected check boxes separated by a comma.
I can create a checkbox but I am unable to display the values in a text box. Please help.
function displayCheckbox(){
$("input:checkbox").change(function() {
selectedCB = [];
notSelectedCB = [];
$("input:checkbox").each(function() {
if ($(this).is(":checked")) {
CountSelectedCB[0] = $(this).attr("id");
}
});
$('input[name=selectedCB]').val(CountSelectedCB);
});
}
Aucun commentaire:
Enregistrer un commentaire