javascript access clipboard code example
Example 1: copy to clipboard javascript dom
navigator.clipboard.writeText('Text');
Example 2: how to access clipboard via js
navigator.clipboard.readText().then(clipText =>
document.getElementById("outbox").innerText = clipText);
Example 3: js get copied text
function updateClipboard(newClip) {
navigator.clipboard.writeText(newClip).then(function() {
/* clipboard successfully set */
}, function() {
/* clipboard write failed */
});
}