Я использую значение setAttribute для создания кнопки удаления - как мне отодвинуть кнопку от введенного текста и обернуть текст таким образом, чтобы кнопка находилась в том же месте?
Вот js fiddle -JS, похоже, не работает на нем, но он работает на моем ПК
https://jsfiddle.net/lewisjames101/aqxwuwbg/
HTML
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>ToDoList</title>
</head>
<body>
<h1>To do list</h1>
<form id="todoform">
<input id = "todoinput">
<button type="button" onclick="todolist()">Add</button>
</form>
<ol id="todolist">
</ol>
<script src="main.js"></script>
</body>
</html>
JS
function todolist(){
var item = document.getElementById("todoinput").value
var text = document.createTextNode(item)
var newitem = document.createElement("li")
newitem.appendChild(text)
document.getElementById("todolist").appendChild(newitem)
document.getElementById ('todoinput').value = "";
var removeTask = document.createElement('input');
removeTask.setAttribute('type', 'button');
removeTask.setAttribute("value", "Remove task");
removeTask.setAttribute("id", "removeButton");
removeTask.addEventListener('click',
function(e) {
confirm ("Are you sure?"); newitem.parentNode.removeChild(newitem);
}, false);
newitem .appendChild(removeTask);
}

