JSFiddle - React, Tailwind, and code Playground
HTML
<div id="items">
<div id="itemList"></div>
</div>
<div id="tab1" class="tab-pane">
<div id="ck-button">
<input type="checkbox" id="one" class="chkbox"/>
<label for="one">First books</label>
</div>
<div id="ck-button">
<input type="checkbox" class="chkbox" id="two" />
<label for="two"> Second book</label>
</div>
</div>
JavaScript
//var $list = $("#itemList");
$(".chkbox").change(function () {
var a = $('label[for="' + this.id + '"]').text();
if (this.checked) {
$("#itemList").append('<p>' + a + '</p>');
}
else {
$("#itemList p:contains('" + a + "')").remove();
}
})