JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" value="" id="text" />
<input type="button" id="test" value="Test" />

<div id='append'>
</div>

JavaScript

$(document).ready(function () {
    i = 0;
    $("#test").click(function () {
        var t = $('#text').val();
        var UL = document.createElement('ul');
        var LI = document.createElement('li');
        $(UL).attr('id', 'main-list' + i).appendTo('body');
        $(LI).text(t).appendTo("#main-list"+i);
        i++;
    });
    $(document).on('click', "ul li", function () {
        $(this).remove();
    });
});