copy to clipboard function javascript
function copyToClipboard(text) {
const elem = document.createElement('textarea');
elem.value = text;
document.body.appendChild(elem);
elem.select();
document.execCommand('copy');
document.body.removeChild(elem);
}function copyToClipboard(text) {
var input = document.body.appendChild(document.createElement("input"));
input.value = text;
input.focus();
input.select();
document.execCommand('copy');
input.parentNode.removeChild(input);
}function copy() {
var copyText = document.querySelector("#input");
copyText.select();
document.execCommand("copy");
}
document.querySelector("#copy").addEventListener("click", copy);
Also in JavaScript:
- how to solve Could not write JSON: Infinite recursion (StackOverflowError)
- linear search js
- angular import service
- jquery get selected option value
- core.js:6228 error typeerror: cannot read property 'height' of undefined
- jquery redirect to url
- javascript replace all spaces
- change input placeholder text jquery
- react bootstrap hide toggle menu when scrolling down
- js for
- mongoose nullable
- set a variable in express.js
- javascript var in quotes
- best js method
- default value of functin atribute
- set css variable from javascript
- await on observable
- localecompare javascript
- get value from textbox in vanilla javascript
- javascript check if string contains a text substring
- Uncaught TypeError: jQuery(...).jqGrid is not a function
- break loop after time javascript
- how to set html label value in jquery
- ERROR in ./node_modules/tns-core-modules/ui/core/view/view.js Module not found: Error: Can't resolve '@nativescript/core/ui/core/view/view' in '/home/deepali/projects/supersquad-client/node_modules/tns-core-modules/ui/core/view'