Palindrome checker Javascript not executing

Not sure why this is being a problem for me, in all the challenges so far the HTML, CSS and JS has never had an issue. I decdided to start the Palindrome Checker project and for whatever reason the JS will not execute. I’m attaching event listeners to a button and I’ve double checked the ID and syntax, I can’t see the problem. Turned off all NoScript blocks and adblocker. If I open the page in a preview window and manually type the code in the console window.onload.addEventListener('click', function() {alert("Hello, world")}) I click in the window and an alert pops.


  <script src="./script.js"></script><!-- tried multiple paths to link src -->
 <label>Text Input</label>
  <input type="text" id="text-input">
  <button type="button" id="check-btn">Check</button>

<div id="result"></div>


document.onload(() => console.log('hi'));

const checkBtn = document.getElementById("check-btn");

checkBtn.addEventListener("click", checkBtnHandler);

function checkBtnHandler(e) {
  console.log("checkBtn clicked.");
  alert("Weee wooo weee wooo! Alert!");
document.addEventListener("click", function() {alert("Hi")});

Edit: Nevermind, it seems like it was the <script src=""> that was the issue. I swear I tried script.js! :anger:

for how the environment is created you should have the script tag immediately before the body closing tag