My javascript code like this :
$(function(){
$(\'input[type=\"radio\"]\').click(function(){
var txt = $(this).parent().text();
var $radio
Updated fiddle: https://jsfiddle.net/m7by6zcw/37/
Basically like Justinas's answer but with the checking/unchecking available.
The only part I really changed was how the text was being outputted, shown below:
let output = [];
$('input[type="radio"]:checked').each( function() {
var txt = $(this).parent().text();
output.push(txt);
});
$('#result-select').text(output.join(' - '));
You need to reset the data of everything else when something checks:
$(`input[name=${name}]:not(:checked)`).data('waschecked', false);