I have a list of checkbox and I want that when it's checked, the label or the value of the checkbox will be added in a list.
The fiddle below, when the checkbox is checked/unchecked, it adds 'on' to the list.
$('.cb').click(function() {
var cbVal = $("input[type='checkbox']").val();
$('ul').append('<li>'+cbVal+'</li>')
});
Aucun commentaire:
Enregistrer un commentaire