3 ms·
One of the things that I found lacking, was doing like general computing-esque business intelligence tasks in htmx. For example, how would you set src on image
by gimme_treefiddy 4y ago
One of the things that I found lacking, was doing like general computing-esque business intelligence tasks in htmx. For example, how would you set src on image tag upon a click. Ended up having to use jquery.
- recursivedoubts 4y agoyou'd use hyperscript for something client side like that: on click set @src to "https://whatever.com/cat.gif https://whatever.com/cat.gif" the htmx approach would be to replace the image tag entirely
- MonadicSystems 4y agoYou should be able to do this with hyperscript. <img src="my_cat.jpg" alt="My cat" _="on click set @src to 'my_other_cat.jpg'">
- ngcc_hk 4y agoAny more full example? Interested.
- bluewalt 4y agoVanilla JS v. jQuery v. hyperscript full examples here: https://hyperscript.org/comparison/ https://hyperscript.org/comparison/
- mattlondon 4y agoI am not sure what the benefit of hyperscript would be here? Why not just use JavaScript + htmx?
- asciiresort 4y agoWhy not just use JavaScript + HTML? <img src="my_cat.jpg" alt="My cat" onclick="this.src = 'my_other_cat.jpg'">