document.addEventListener("DOMContentLoaded", function () { // subtitles var b = document.createElement("button"), c = document.createElement("div"); c.appendChild(b); b.innerHTML = "toggle"; b.addEventListener("click", function () { document.body.classList.toggle("subtitle"); }); document.body.append(c); c.id = "controls"; })