I want to make an html form which asks the user to input values in a text field and click "submit" button. After the user clicks the "submit" button, the value should be appended to a list of all previously entered values. The user should be able to select the entered item to edit or remove it. Something that should look similar to this:
I tried to use this code. The item gets added to the list but not inside a box in clickable format as I showed in the image before.
var button = document.getElementById("submit-button");
var text = document.getElementById("text-field");
var list=document.getElementById("list");
button.addEventListener('click', function (event) {
var node = document.createElement("LI");
var textnode = document.createTextNode(text.value);
node.appendChild(textnode);
//to append the item
list.appendChild(node);}
, false);
EDIT: Here is the html code:
<html>
<head>
</head>
<body>
<form>
Enter URL: <br>
<input type="text" id="text-field">
<br>
<button id="submit-button">Submit</button>
</form>
<ul id="list"></ul>
<script src="myscript.js"> </script>
</body>
</html>