From 9fa68ce0019b45b6d4643b4a84c97a2791144ca2 Mon Sep 17 00:00:00 2001 From: Kris0011 Date: Sun, 15 Oct 2023 18:02:36 +0530 Subject: [PATCH] Search List added for components --- components.html | 20 +++++++++++++------- script.js | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 script.js diff --git a/components.html b/components.html index c6db3ff..6861ca1 100644 --- a/components.html +++ b/components.html @@ -29,8 +29,8 @@ @@ -39,26 +39,32 @@
+
- -
+

Login Page

By : 12Kishan

+ +
-
+
+
-

Contact Form

+

Contact Form

By : NaitikPatel-325

- + + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..c01d7fa --- /dev/null +++ b/script.js @@ -0,0 +1,19 @@ +function searchComponents() { + const searchInput = document.getElementById("searchInput").value.toLowerCase(); + const cards = document.querySelectorAll(".card"); + + + cards.forEach(card => { + const title = card.querySelector(".details h1").textContent.toLowerCase(); + const author = card.querySelector(".details h2").textContent.toLowerCase(); + console.log(title, author); + + if (title.includes(searchInput) || author.includes(searchInput)) { + card.style.display = "block"; + foundResults = true; + } else { + card.style.display = "none"; + } + }); + +} \ No newline at end of file