From f66c470f357c1c87334464dc9c806b571743cd37 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Fri, 10 Nov 2023 11:38:33 -0500 Subject: [PATCH] add button --- app.js | 8 ++++++++ index.html | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/app.js b/app.js index 5f2be35..6133041 100644 --- a/app.js +++ b/app.js @@ -25,3 +25,11 @@ for (const deleteButton of deleteButtons) { event.target.parentNode.remove() }) } + +const addButtons = document.querySelectorAll('button.add'); +for (const addButton of addButtons) { + addButton.addEventListener('click', (event)=>{ + const template = document.querySelector('template').content.children[0]; + event.target.parentNode.children[0].appendChild(template.cloneNode(true)) + }) +} diff --git a/index.html b/index.html index 984470c..83998d2 100644 --- a/index.html +++ b/index.html @@ -44,5 +44,14 @@ +