JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" name="a_d" value="1" /><label>a_d</label>
<input type="checkbox" name="a_d" value="2" /><label>a_d1</label>
<input type="checkbox" name="a_d" value="3" /><label>a_d2</label>
<input type="checkbox" name="a_d" value="4" /><label>a_d3</label>
<div id="populate"></div>
<input type="button" value="Select" id="getSelected"/>
CSS
#populate {
border: 1px solid red;
}
JavaScript
$(function() {
$('#getSelected').click(function() {
$('[name="a_d"]:checked').each(function(){
$(this).next().andSelf().appendTo('#populate');
});
});
});