0

I'm going to be blunt. I haven't done HTML/JS coding in years. I'm trying to wait until my window and document are in a completed readyState to add a function to a button externally. I'm struggling. I feel like- no I am a noob at this point.

Does anyone know how to make JS execution wait until the window and document are both in a readyState?

What I'm trying to do:

Test the button on my page. I want it to console log "button clicked" when I click it so that I know it is working. I'm using an external file called "setUp.js".

My html:

<html>
    <head>
        <title>tbg</title>
        <script src="scripts/setUp/setUp.js"></script>
        <link rel="stylesheet" href="css/theme.css">
    </head>
    <body>
        <div id="staging">
            <p>
              test
            </p>
            <button id="test">
                test
            </button>
        </div>
    </body>
</html>```

0 Answers0