title: How to get javascript to Select new element that has just been created?
body: <p>I am making a book list, and it has a delete button on it. The creating element up untill appendChild is working already, the problem is just the delete button.</p>
  
  <p>The code for books: </p>
  
  <pre><code>function createEach(e){
    let divTitle = document.createElement('div');
    divTitle.className = 'cell medium-3';
    divTitle.innerHTML = Book.title;
    divTitleNd = divTitle.outerHTML;
  </code></pre>
  
  <p>The code for delete button:</p>
  
  <pre><code>let deleteBtn = document.createElement('a');
    deleteBtn.className = 'del-btn button tiny alert';
    deleteBtn.innerHTML = 'x';
    deleteBtn.href = '#';
    deleteBtnNd = deleteBtn.outerHTML;
  </code></pre>
  
  <p>before i have document.querySelector the delete button with the class del-btn, but now if i run this code:</p>
  
  <pre><code>let deleteButton = document.querySelector('.del-btn');
  function deleteBook(e){
    e.target.parentElement.parentElement.remove();
  }
  </code></pre>
  
  <p>the delete Button for newly created element just wont work. Any way to fix this? Thanks!</p>