From 7120d95504ee02a9ad5b98f0982b82ebfb9897a2 Mon Sep 17 00:00:00 2001 From: Sascha Schulz <sschulz@dh-software.de> Date: Di, 14 Feb 2023 17:44:39 +0100 Subject: [PATCH] add parent.appendChild() example --- index.html | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/index.html b/index.html index 504d73e..4713b32 100644 --- a/index.html +++ b/index.html @@ -529,7 +529,7 @@ <pre> <code class="js" data-trim data-line-numbers> // findet das erste Element - const element = document.querySelector("#id"); + const parent = document.querySelector("#id"); // findet alle Elemente const elements = document.querySelectorAll("#id"); @@ -541,6 +541,9 @@ // Click-Event }); + // Element anhängen + parent.appendChild(newElement); + newElement.remove(); </code> </pre> -- Gitblit v1.9.3