What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-27 23:00:02
js copy to clipboard cross browser
/** copy text to the clipboard */ function copy2clipboard( text, callback /* optional */ ) { // use modern clipboard API if ( navigator.clipboard ) { navigator.clipboard.writeText( text ) .then( function(){ // if a callback is provided, call it ... Add solution -
Javascript 2022-02-19 14:20:01
how to enable click copy function using js
var copyTextareaBtn = document.querySelector('.js-textareacopybtn'); copyTextareaBtn.addEventListener('click', function(event) { var copyTextarea = document.querySelector('.js-copytextarea'); copyTextarea.focus(); copyTextarea.select(); try { ... Add solution -
Javascript 2021-11-09 05:39:24
chrome bookmarklet copy text
// This needs to be minified (and prefixed) to work // I just put the full function here to better show what the code is doing // Use the bottom line of code and replace "Text To Copy" with your own // text and you're good to go! (function (t... Add solution -
Javascript 2021-10-29 00:24:10
copy link url javascript
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); } Add solution