Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
append / appendChild not working as expected

I am trying to create a twitter extension in which I want to add an extra button along with all other like / bookmark buttons. For that I am using appendChild and diff other functions. But they only add the button to one node , when I update another , the previous is vanished.

var btn = document.createElement("button");
btn.innerHTML = "Bookmark";
btn.id = "bookmark-btn";

function insertAfter(newNode, existingNode) {
  existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);
}

ready("article", (article) => {
  const tweet = article.querySelector("div[role=group]");
  insertAfter( btn, tweet.childNodes[2] )

  // I also tried tweet.appendChild(btn);

});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!