Skip to content
Advertisement

is there any way to copy the rendered HTML of a div?

I am working on a signature generator for emails and I want to copy the final signature with the press of a button instead of manually selecting the signature and copying it to the clipboard. This means I need the image, text and styling for them.

I have tried a couple of variants, including the w3schools one, but no success, some of them are only copying the text, but without the styling.

Example: https://www.mail-signatures.com/signature-generator/

Advertisement

Answer

Please try the below code.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement