feat: add search functionality to filter books by title or author

This commit is contained in:
2026-06-01 21:14:32 -03:00
parent c1cd76ecb0
commit af18e62e06

View File

@@ -64,5 +64,14 @@ document.getElementById('boton-agregar').addEventListener('click', () => {
document.getElementById('calificacion').value = ""; document.getElementById('calificacion').value = "";
}) })
document.getElementById('searchBar').addEventListener('input', (e) => {
const query = e.target.value.toLowerCase();
const filtered = books.filter((book) =>
book.tittle.toLowerCase().includes(query) || book.author.toLowerCase().includes(query)
)
renderTable(filtered);
})
renderTable(books); renderTable(books);