/* * include id-specified html into corresponding div */ window.addEventListener( "DOMContentLoaded", function () { function includeIdFiles() { for (let id of ["header", "footer"]) { let e = document.getElementById(id), fn = e.id + ".html"; fetch(fn).then((resp) => { resp.text().then((text) => { let newmenu = e.insertAdjacentHTML("afterend", text); e.remove(); newmenu.id = id; }); }); } } function init() { includeIdFiles(); } init(); });