From af18e62e06a32b5c53650dbb0a020d9651a9d8d2 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Mon, 1 Jun 2026 21:14:32 -0300 Subject: [PATCH] feat: add search functionality to filter books by title or author --- script.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script.js b/script.js index 77ab5d2..46a9dd1 100644 --- a/script.js +++ b/script.js @@ -64,5 +64,14 @@ document.getElementById('boton-agregar').addEventListener('click', () => { 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); \ No newline at end of file