JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
<input type="radio" checked="" value="1" name="question">question 1
</div>
<div class="container">
<input type="radio" value="2" name="question">question 2
</div>

CSS

.container {
    margin: 10px;
}
label {
    padding: 6px 12px;
    background-color: #666;
    color: #fff;
}
input[type=radio] {
    display: none;
}
.selected {
    background-color: #000;
}

JavaScript

$(function() {
    $('.container input[type="radio"]').each(function(index) {
        console.log($(this));
        $(this).attr('id', 'radio' + index);
        var label = $('<label />', {'for': 'radio' + index}).html($(this).parent().html());
        $(this).parent().empty().append(label);
    });
    $('label').click(function () {
       $('label').removeClass('selected');
       $(this).addClass('selected');
    });        
});