Add span in querySelector

Earlier querySelector for download button was returning a div, on which we called the getAttribute function hence returning null
This now returns a <span> element which returns the correct link with getAttribute
This commit is contained in:
Nikhil Tanwar 2022-01-24 19:23:26 +05:30
parent 45e9b76b19
commit f6309bb4c8
1 changed files with 1 additions and 1 deletions

View File

@ -322,7 +322,7 @@
booksToDelete.forEach(book => {iso.remove(book);}); booksToDelete.forEach(book => {iso.remove(book);});
books.forEach((book) => { books.forEach((book) => {
iso.insert(generateBookHtml(book, sort)) iso.insert(generateBookHtml(book, sort))
const downloadButton = document.querySelector(`[data-id="${getInnerHtml(book, 'id')}"] .book__download`); const downloadButton = document.querySelector(`[data-id="${getInnerHtml(book, 'id')}"] .book__download span`);
if (downloadButton) { if (downloadButton) {
insertModal(downloadButton); insertModal(downloadButton);
} }