-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.html
52 lines (49 loc) · 2.75 KB
/
test.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
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootstrap Dropdown Test</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<div class="input-group mb-3">
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="module-select" data-bs-toggle="dropdown" aria-expanded="false">
Select a Module
</button>
<ul class="dropdown-menu" aria-labelledby="module-select">
<li><a class="dropdown-item" href="#" data-value="Atlas Setup">Atlas Setup</a></li>
<li><a class="dropdown-item" href="#" data-value="Data Modeling">Data Modeling</a></li>
<li><a class="dropdown-item" href="#" data-value="Aggregation Framework">Aggregation Framework</a></li>
<li><a class="dropdown-item" href="#" data-value="Atlas Search">Atlas Search</a></li>
<li><a class="dropdown-item" href="#" data-value="Atlas Vector Search">Atlas Vector Search</a></li>
<li><a class="dropdown-item" href="#" data-value="AI / RAG">AI / RAG</a></li>
<li><a class="dropdown-item" href="#" data-value="Library Management Application">Library Management Application</a></li>
</ul>
</div>
<input type="text" id="user-input" class="form-control" placeholder="Type your question here..." aria-label="Text input with dropdown button">
<button id="send-button" class="btn btn-primary">Send</button>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const moduleSelect = document.getElementById('module-select');
const moduleItems = document.querySelectorAll('.dropdown-item');
moduleItems.forEach(item => {
item.addEventListener('click', function(event) {
event.preventDefault();
const selectedModule = this.getAttribute('data-value');
console.log('Module selected:', selectedModule);
moduleSelect.textContent = this.textContent;
moduleItems.forEach(i => i.classList.remove('active'));
this.classList.add('active');
});
});
});
</script>
</body>
</html>