JSFiddle - React, Tailwind, and code Playground
by shahrukh007
HTML
<html>
<head>
<body>
<input id="input_Text"><br>
<button type="button" onclick="myFunction();">Submit</button><br>
<ul id="list"></ul>
<script>
function myFunction() {
var input = document.getElementById("input_Text").value;
document.getElementById("input_Text").value = "";
var input_Value = document.createTextNode(input);
var checkbox = document.createElement('input');
var newList = document.createElement("li");
var editButton=document.createElement("button");
editButton.innerText="Edit";
var deleteButton=document.createElement("button");
deleteButton.innerText="Delete";
newList.appendChild(checkbox);
newList.appendChild(input_Value);
newList.appendChild(editButton);
newList.appendChild(deleteButton);
document.getElementById("list").appendChild(newList);
deleteButton.onclick = removeItem;
editButton.onclick = editItem;
function removeItem() {
var x=this.parentNode;
var ul=x.parentNode;
ul.removeChild(x);
}
function editItem() {
}
}
</script>
</body>
</head>
</html>