Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html pass a string to clipboard

function copyToClipboard(text) {
    var dummy = document.createElement("textarea");
    // to avoid breaking orgain page when copying more words
    // cant copy when adding below this code
    // dummy.style.display = 'none'
    document.body.appendChild(dummy);
    //Be careful if you use texarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard
    dummy.value = text;
    dummy.select();
    document.execCommand("copy");
    document.body.removeChild(dummy);
}
copyToClipboard('hello world')
copyToClipboard('hello
world')
Comment

PREVIOUS NEXT
Code Example
Html :: salesforce aura toggle input 
Html :: html website ideas 
Html :: html set character encoding 
Html :: center text in a html file 
Html :: onclick a tag 
Html :: aos library 
Html :: html5 video player autoplay 
Html :: bootstrap modal popup backdrop false 
Html :: bootstrap grids examples 
Html :: how to add image in html link 
Html :: html link tag for other website 
Html :: did not expect server html to contain a div in div 
Html :: display html input datetime-local value 
Html :: inline bootstrap 
Html :: thymeleaf input radio checked 
Html :: onclick to next page in html 
Html :: bluetooth headphones cutting out 
Html :: italique html 
Html :: centre text 
Html :: title attribute label tag html 
Html :: bootstrap font-weight bold 
Html :: png favicon 
Html :: v-select reduce 
Html :: select option default value 
Html :: how do i link two pages in html 
Html :: html code contact form template 
Html :: table row html 
Html :: html email link 
Html :: onclick on anchor tag 
Html :: change icon title react 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =