-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
47 lines (41 loc) · 1.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Home Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="bg ">
<div class="main container">
<h1>Search domain for Interview Questions</h1>
<div class=" mt-3 search-box py-3 ">
<form class="d-flex" id="searchForm">
<input class="form-control me-2" id="searchQuery" type="search" placeholder="Search..." aria-label="Search">
<button class="btn btn-outline-primary" type="submit">Search</button>
</form>
</div>
</div>
</div>
<script>
const data = [
{ title: 'machine learning', link: 'ml.html' },
{ title: 'software development', link: 'sde.html' },
{ title: 'data analyst', link: 'data.html' },
{ title: 'finance', link: 'finance.html' },
{ title: 'data analyst', link: 'data.html' },
];
document.getElementById('searchForm').addEventListener('submit', function(event) {
event.preventDefault();
const searchQuery = document.getElementById('searchQuery').value.trim().toLowerCase();
const filteredResults = data.filter(item => item.title.toLowerCase().includes(searchQuery));
if (filteredResults.length > 0) {
window.location.href = filteredResults[0].link;
} else {
alert('No results found for your search query.');
}
});
</script>
</body>