<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./assets/css/all.min.css">
    <link rel="stylesheet" href="./assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="./assets/css/fontawesome.min.css">
    <link rel="stylesheet" href="./assets/css/style.css">
</head>

<body>
    <!-- Search Field -->
    <div>
        <input type="text" id="searchInput" placeholder="Search any number..." />
        <button onclick="searchTable()">Search</button>
        <button onclick="resetTable()">Reset</button>
    </div>


    <script>
        function searchTable() {
            const input = document.getElementById("searchInput").value.toLowerCase();
            const rows = document.querySelectorAll("table .tbody");
            let found = false;

            rows.forEach(row => {
                const text = row.textContent.toLowerCase();
                if (text.includes(input)) {
                    row.style.visibility = "visible";
                    found = true;
                } else {
                    row.style.visibility = "collapse";
                }
            });

            // Alert only if nothing matched
            if (!found && input !== "") {
                alert("No matching result found.");
            }
        }

        function resetTable() {
            document.getElementById("searchInput").value = "";
            const rows = document.querySelectorAll("table .tbody");
            rows.forEach(row => row.style.visibility = "visible");
        }
    </script>
</body>

</html>