title: How to access elements that were created in script?
body: <p>In the function below, I create cards that have a toggle button and remove button. However, when I try to access the buttons with a queryselector, I get null. Anyone know how to access elements that were created in a different file? I can provide the full files if needed.</p>
  <pre><code>function updateDisplay() {
      for (i = 0; i &lt; myLibrary.length; i++){
      let div = document.createElement('div');
      let title = document.createElement('h5');
      let author = document.createElement('h5');
      let pages = document.createElement('h5');
      let isRead = document.createElement('h5');
      let removeButton = document.createElement('button');
      let toggleButton = document.createElement('button');
      div.classList.add('card');
      title.classList.add('title');
      author.classList.add('author');
      pages.classList.add('pages');
      isRead.classList.add('isRead');
      removeButton.classList.add('removeButton');
      toggleButton.classList.add('toggleButton');
      title.textContent = myLibrary[i].title;
      author.textContent = myLibrary[i].author;
      pages.textContent = `${myLibrary[i].pages} pages`;
      isRead.textContent = myLibrary[i].isRead ? 'Read' : 'Unread';
      removeButton.textContent = 'Remove';
      toggleButton.textContent = 'Toggle Read Status';
  </code></pre>