Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a clone of html element in _hyperscript

Tags:

hyperscript

How to make a clone of html element in _hyperscript?

For example, I want to see a copy of a button after clicking on it. Something like:

<button _="on click put me after me">Test</button>
like image 866
Ruslan Ustitc Avatar asked Oct 27 '25 23:10

Ruslan Ustitc


1 Answers

If you want the hyperscript to work for new nodes I currently do something like this:

<div id="test123">
   <div _="on click log 'Test' then put my outerHTML after me 
       _hyperscript.processNode(#test123)">Copy Me</div>
</div>
like image 197
Steve Avatar answered Oct 29 '25 15:10

Steve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!