document.addEventListener('DOMContentLoaded', function() { var links = document.querySelectorAll('#includedSidebarContent'); links.forEach(function(link) { link.addEventListener('click', function(event) { event.preventDefault(); // Prevent the default behavior of the link var path = this.getAttribute('href'); // Get the href attribute of the clicked link loadContent(path); // Load content based on the selected path }); }); });