diff --git a/datasette/templates/_codemirror_foot.html b/datasette/templates/_codemirror_foot.html index 0c9255ab..a624c8a4 100644 --- a/datasette/templates/_codemirror_foot.html +++ b/datasette/templates/_codemirror_foot.html @@ -5,7 +5,7 @@ const schema = {}; {% endif %} - window.onload = () => { + window.addEventListener("DOMContentLoaded", () => { const sqlFormat = document.querySelector("button#sql-format"); const readOnly = document.querySelector("pre#sql-query"); const sqlInput = document.querySelector("textarea#sql-editor"); @@ -38,5 +38,5 @@ }); } } - }; + });