Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| // Search functionality | |
| const searchInput = document.querySelector('input[type="text"]'); | |
| if (searchInput) { | |
| searchInput.addEventListener('input', function(e) { | |
| const searchTerm = e.target.value.toLowerCase(); | |
| const rows = document.querySelectorAll('tbody tr'); | |
| rows.forEach(row => { | |
| const text = row.textContent.toLowerCase(); | |
| row.style.display = text.includes(searchTerm) ? '' : 'none'; | |
| }); | |
| }); | |
| } | |
| // Status filter functionality could be added here | |
| }); | |
| // Example of how to fetch data from an API | |
| async function fetchExamData() { | |
| try { | |
| const response = await fetch('https://api.example.com/exams'); | |
| const data = await response.json(); | |
| return data; | |
| } catch (error) { | |
| console.error('Error fetching exam data:', error); | |
| return []; | |
| } | |
| } |