3 ms·
how would you add listeners if you were doing an html string? the first approach allows you to do something like this ``` const myButton = button({ onclick:
by spencerchubb 2y ago
how would you add listeners if you were doing an html string? the first approach allows you to do something like this
```
const myButton = button({
onclick: e => console.log(e),
textContent: "Click me"
})
```
- TimTheTinker 2y agoUse topElement.querySelector('button'), then add the listener programmatically.