Copy text to clipboard as plain and html

Hello! I'm using a "copy to clipboard" button to copy the value {{output_textfield.value}}
But i want to provide two buttons to let the user the option to copy either plain text or text with html markup. how do i need to customize the command in each case?
Thanks!

Hi @paul84!

If you're looking to convert HTML to plain text you can try removing the tags with a regular expression, something like

text.replace(/<[^>]*>/g, '');

In your case, you could have one button copy {{output_textfield.value}} to your clipboard while the other copies {{output_textfield.value.replace(/<[^>]*>/g, '')}}. Does that work for you?

1 Like

@Kabirdas Thanks a lot! That worked for me.