Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’. on created div element but not existing

I am creating a draggable tier list that loads a list in a text file and then generates cards with the text from each line. The cards can then be dragged from a card bank on the bottom into rows of tiers. Everything works fine with cards I create manually in the html file, but when I attempt to drag one of the generated cards I get the error below:

cards.js:12 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

HTML:

<!DOCTYPE html> 
<html>
    <head>
        <title>Tier List</title>
        <link rel="stylesheet" type="text/css" href="style.css">
        <style>
            @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');
            @import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Poetsen+One&display=swap');
        </style>
        
    </head>
    <body>
        <h1 class="noto-sans-title">Tier List</h1>
        <div id="board">
            <div class="rowholder">
                <div class="label noto-sans-title pink">
                    SSS
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title red">
                    S
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title orange">
                    A
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                    <div class="card" id="card7" draggable="true">Test</div>
                    <div class="card" id="card8" draggable="true">????</div>
                    <div class="card" id="card9" draggable="true">????</div>
                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title gold">
                    B
                </div>
                <div class="row" ondrop="onDrop(event, this)">

                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title yellow">
                    C
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                    
                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title green">
                    D
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                    
                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title blue">
                    E
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                    
                </div>
            </div>
            <div class="rowholder">
                <div class="label noto-sans-title purple">
                    F
                </div>
                <div class="row" ondrop="onDrop(event, this)">
                    
                </div>
            </div>
        </div>
        <h2 class="noto-sans-title">Select</h2>
        <div id="bank">
            
            <div class="rowholder">
                <div class="row" id="bankRow" ondrop="onDrop(event, this)">

                </div>
            </div>
        </div>
    </body>
    <script src="./cards.js"></script>
</html>

Javascript:

var cardIndex = 0;

fetch('data1.txt')
  .then(response => response.text())
  .then(text => text.trim().split('n'))
  .then((tagsImported) => {
    tagsImported.forEach((element) => {
        const card = document.createElement('div');
        card.classList.add('card');
        card.id = 'card'+cardIndex++;
        card.setAttribute('draggable', 'true');
        card.innerHTML = element;
        console.log(element);
        const bank = document.getElementById('bankRow');
        bank.appendChild(card);
    });
  });
  
  const rows = document.querySelectorAll('.row');

  const allowDrop = (event) => {
      event.preventDefault();
  }
  
  const onDrop = (event, element) => {
      event.preventDefault();
      const draggedCardId = event.dataTransfer.getData('id');
      const draggedCard = document.getElementById(draggedCardId);
      console.log(draggedCardId);
      element.appendChild(draggedCard);
      console.log('Element Dropped');
  }
  
  rows.forEach((row) => {
      row.ondragover = allowDrop;
  })
  
  const card = document.querySelectorAll('.card');
  
  const onDragStart = (event) => {
      console.log('Dragging Element')
      event.dataTransfer.setData('id', event.target.id);
  }
  
  const onDragEnd = (event) => {
      console.log('Dragging Ended');
  }
  
  card.forEach((card) => {
      card.ondragstart = onDragStart;
      card.ondragend = onDragEnd;
  })

New contributor

Jonathan KCJC is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật