The WordPress Show: How to Create a “COPY URL TO CLIPBOARD” link in WordPress
WATCH
READ
I found it hard to find HTML code to create a "Copy URL To Clipboard" button in WordPress that matched my button styles.
But thanks to https://orclqa.com/copy-url-clipboard/ - I found it. This video shows how I did it.
<button>Copy Link</button>
<script>
function copyToClipboard(text) {
var inputc = document.body.appendChild(document.createElement("input"));
inputc.value = window.location.href;
inputc.focus();
inputc.select();
document.execCommand('copy');
inputc.parentNode.removeChild(inputc);
alert("URL Copied.");
}
</script>
Paul Hickey is a Digital Creator, spending about about 60% of his work time building WordPress websites for small businesses, 20% of his work time running an eCommerce Sports Cards and Digital Collectibles business at NoOffseason.com and another 20% of his work time authoring books and creating digital art in the form of NFTs (Non-Fungible Tokens).
In each of his entrepreneurial endeavors, he believes it's important to create a community. He strives to do this by creating helpful content for his audience (community members) to learn about the topics he's interested in.
This is why he creates content on the following topics:
- WordPress Web Design and Development (including WooCommerce)
- Sports Cards Collecting (including Competitive Card Collecting)
- NFTs and Digital Collectibles