Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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" }) ```



Use topElement.querySelector('button'), then add the listener programmatically.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: