【JavaScript Tips】Simply set multiple attributes to the created element
from
const input = document.createElement('input');
input.setAttribute("id", "1");
input.setAttribute("type", "button");
input.setAttribute("value", "delete");
.
.
.
to
const input = document.createElement('input');
const setInput = Object.assign(input, {type: "button", value: "delete", id: `${id}`, onclick: () => {}}