You can use the pseudo-selector :checked
that is part of the W3C specification. Natively, without recourse to libraries.
Using document.querySelectorAll('input:checked');
you get a list of the elements that are marked.
In your code you could use this way:
var confirma = document.getElementById('confirma');
var resultado = document.getElementById('resultado');
confirma.addEventListener('click', function() {
var checkados = document.querySelectorAll('input:checked');
resultado.innerHTML = [].map.call(checkados, function(el){
return el.value;
}).join(', ');
});
jsFiddle: link
If you want to use the jQuery API for example you can do so, also using :checked
but jQuery :
$('#confirma').on('click', function() {
var valores = $('input:checked').map(function() {
return this.value;
}).get().join(', ');
$('#resultado').html(valores);
});
jsFiddle: link