JSFiddle - React, Tailwind, and code Playground

by Mi_Creativity

HTML

<button id="copy">Copy</button>
<button id="cut">Cut</button>
<button id="paste">Pate</button>

JavaScript

var Copy =  document.getElementById('copy'),
    Cut =  document.getElementById('cut'),
    Paste =  document.getElementById('paste');

// Checking Clipboard API without an action from the user
console.log('Copy:' + document.queryCommandSupported('copy'));
console.log('Cut:' + document.queryCommandSupported('cut'));
console.log('Paste:' + document.queryCommandSupported('paste'));


//Now checking the clipboard API upon a user action
Copy.addEventListener('click', function(){
	console.log('Copy:' + document.queryCommandSupported('copy'));
});

Cut.addEventListener('click', function(){
	console.log('Cut:' + document.queryCommandSupported('cut'));
});

Paste.addEventListener('click', function(){
	console.log('Paste:' + document.queryCommandSupported('paste'));
});