News for hackers. Stuff that matters.
Re:TinyJS – Shorten JavaScript QuerySelect with $ and $$ by spencerchubb on Wednesday October 02, 2024 @07:37PM (#41725947)
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" }) ```

Re:TinyJS – Shorten JavaScript QuerySelect with $ and $$ by TimTheTinker on Wednesday October 02, 2024 @10:31PM (#41726789)
Use topElement.querySelector('button'), then add the listener programmatically.