Copy contents of DIV on Click

Is it possible to select all contents of a DIV and copy to clipboard with a single click like this

using Actions?

image

I have seen the copy option in browser component but havent used it yet.
So far, I have always used a JS function to copy whatever text or html I need to copy.
You can find some references by searching the community.

Keeping an eye on this post if there is a Wappler only way to do it.

The only way I have found so far is to populate an Input field instead of a DIV, and then hide all the Input field borders etc. That way you can use the On-Click Dynamic Event and use the 'Select All' and 'Copy' options in the Browser Component.

In my case, the data is dynamic and a repeat so I would need to populate a variable which in-turn would be used to populate the Input field.

Does anyone know of any other way?

Does anyone have any other ideas on this?

If you definitely want a Wappler-only solution, I don’t have an answer. If you’re considering alternatives, you could try the solution mentioned in this thread. This would allow you specify the div to be copied dynamically - eg it could include a div with repeats (or not) and include images etc.