pages/menu-inject.js

13 lines
369 B
JavaScript

// Assuming you have an element with the ID "menu" where you want to inject the menu
const menuElement = document.getElementById('menu');
// Fetch the menu content from menu.html
fetch('menu.html')
.then(response => response.text())
.then(data => {
menuElement.innerHTML = data;
})
.catch(error => {
console.error('Error fetching menu:', error);
});