JSFiddle - React, Tailwind, and code Playground
HTML
<input name="expenseCat"/>
<div id="selectedRadio"></div>
CSS
div{
width: 300px;
height: 200px;
border: 1px solid black;
}
input{
margin-bottom: 10px;
}
JavaScript
var desc1 = 'Example description1';
var desc2 = 'Example description2';
var arr = ["Example description1","Example description2"];
$('input[name="expenseCat"]').change(function() {
$.each( arr, function( key, value ) {
var oldval = $('#selectedRadio').text();
$('#selectedRadio').text( oldval+"\n" + value);
$('#selectedRadio').html( $('#selectedRadio').text().replace(/\n/g, '<br />'));
});
});