JSFiddle - React, Tailwind, and code Playground
by devdev
HTML
<button id="addItem">Add item</button>
<ul id="items">
</ul>
JavaScript
function addItem(){
var text = prompt("Insert item's text", "item's text (click to Edit)");
if(!text) return;
var item = $('<li><span class="text">'+text+'</span> <button class="remove">Remove Item</button></li>');
item.find("button.remove").click(function(){item.remove()});
item.find("span.text").click(function(){
var text = prompt('Edit item', $(this).text());
if(!text) return;
$(this).text(text);
});
$("ul#items").append(item);
}
$("#addItem").click(addItem);
// for(var i=0; i<5; i++) addItem();