JSFiddle - React, Tailwind, and code Playground
HTML
Question 1 Yes<input name='chk1' value="yes" type='radio' />No<input name='chk1' value="no" type='radio' /><br />
Question 2 Yes<input name='chk2' value="yes" type='radio' />No<input name='chk2' value="no" type='radio' /><br />
Question 3 Yes<input name='chk3' value="yes" type='radio' />No<input name='chk3' value="no" type='radio' /><br />
Other comments<textarea id='comment'></textarea><br /><input type=submit name=submit value='Post' />
JavaScript
$('input[name="chk1"]').change(function(){
checkQuestion("Question 1", this.value);
});
$('input[name="chk2"]').change(function(){
checkQuestion("Question 2", this.value);
});
$('input[name="chk3"]').change(function(){
checkQuestion("Question 3", this.value);
});
function checkQuestion(text, value) {
if ($('#comment').text().indexOf(text)<0)
$('#comment').text($('#comment').text() + text + ":" + value + "\n");
else {
var oldValue = 'yes';
if (value==='yes') oldValue = 'no';
$('#comment').text($('#comment').text().replace(text + ":" + oldValue, text + ":" + value));
}
}