diff --git a/script.js b/script.js index f34fa59..787bf14 100644 --- a/script.js +++ b/script.js @@ -13,10 +13,12 @@ Make the "Click me!" button rotate when the visitor clicks it: */ const btn = document.querySelector("button"); // Get the button from the page // Detect clicks on the button -btn.onclick = function() { - // The JS works in conjunction with the 'rotated' code in style.css - btn.classList.toggle('rotated'); -}; +if (btn) { + btn.onclick = function() { + // The JS works in conjunction with the 'rotated' code in style.css + btn.classList.toggle("rotated"); + }; +} // This is a single line JS comment /*