diff --git a/frontend.js b/frontend.js index 0c8189d..9035973 100644 --- a/frontend.js +++ b/frontend.js @@ -24,12 +24,21 @@ function createParagraph(elementID, text) { return elem } -function createButton(elementID, text) { +function createButton(elementID, text, attributes = {}) { let elem = createElement("button", elementID); elem.innerText = `${text}` + for (const [name, value] of Object.entries(attributes)) { + elem.setAttribute(name, value); + } return elem; } +function changeAttributes(elem, attributes = {}) { + for (const [name, value] of Object.entries(attributes)) { + elem.setAttribute(name, value); + } +} + function createImage(elementID, src) { return createElement("img", elementID, { src: src }); }