Following this [page](https://javascript.info/introduction-browser-events), I'm finding that I can't execute an 'onclick' handler like the handler set up here:

```js
function handler() {
  console.log(5);
}
```

```html
<button onclick="handler()"></button>
```

This is the only module I use: `<script type="module" src="../js/js_test.js"></script>`. It's in the header.

This is the error I get:

[![enter image description here](https://i.stack.imgur.com/Ppesr.png)](https://i.stack.imgur.com/Ppesr.png)

It works when I have this in my module:

```js
let button = document.querySelector('button');
button.onclick = handler;

```

Any ideas?

P.s. I can't access variables I write on my module on the console. I thought I once could do this. Don't know if that's helpful.