Clipboard.js copy html Copy content and keep formating (just like a user would do by selecting the content and copying). Try it, hit copy button, then paste into Wordpress editor or your email client. by Gabriel Le Breton September 25, 2018 HTML <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.10/clipboard.min.js"></script> <!-- Target --> <div id="bar"> <h1>hello world</h1> <strong>Some html text</strong> <br> <img src="http://placekitten.com/g/200/300" alt="cat"> </div> <!-- Trigger --> <button class="btn" data-clipboard-action="copy" data-clipboard-target="#bar"> Copy to clipboard </button> JavaScript var clipboard = new Clipboard('.btn');