// The code below should help
let btn = document.createElement("button");
btn.innerHTML = "Submit";
btn.type = "submit";
btn.name = "formBtn";
document.body.appendChild(btn);
let btn = document.createElement("button");
btn.innerHTML = "Save";
btn.onclick = function () {
alert("Button is clicked");
};
document.body.appendChild(btn);
<script>
function addItem(){
var li = document.createElement("LI");
var input = document.getElementById("add");
li.innerHTML = input.value;
input.value = "";
document.getElementById("faves").appendChild(li);
}
</script>
<input type="button" id="btnAdd" value="Add" onclick="addItem()">