0

you guys probably resolve this quickly. I'm not really experienced in Javascript to this moment and simply want to append an anchor tag to a section and "transfer" the sections id value to the href of that specific anchor tag.


This is what I tried so far

const threadline = document.querySelectorAll(".threadline");
const threadlineID = threadline.id;
const threadlineAnchor = document.createElement("a");
threadlineAnchor.setAttribute('href', threadlineID);
threadline.appendChild(threadlineAnchor);

const threadline = document.querySelectorAll(".threadline");
const threadlineID = threadline.id;
const threadlineAnchor = document.createElement("a");
threadlineAnchor.setAttribute('href', threadlineID);
threadline.appendChild(threadlineAnchor);
<section id="description" class="threadline"></section>
Simplicius
  • 2,009
  • 1
  • 5
  • 19

0 Answers0