Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue js copy text to clipboard

  methods: {
    copyURL() {
      var Url = this.$refs.mylink;
      Url.innerHTML = window.location.href;
      console.log(Url.innerHTML)
      Url.select();
      document.execCommand("copy");
    }
  }
Comment

vuejs copy to clipboard

copyLink(link) {  
const el = document.createElement('textarea');  
        el.value = link;                    
        el.setAttribute('readonly', '');                
        el.style.position = 'absolute';                     
        el.style.left = '-9999px';                      
        document.body.appendChild(el);                  
        const selected =  document.getSelection().rangeCount > 0  ? document.getSelection().getRangeAt(0) : false;                                    
        el.select();                                    
        document.execCommand('copy');                   
        document.body.removeChild(el);                  
        if (selected) {                                 
          document.getSelection().removeAllRanges();    
          document.getSelection().addRange(selected);   
        }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: disable key enter react-hook-form 
Javascript :: reversed array loop 
Javascript :: react form submit 
Javascript :: react native run ios release 
Javascript :: ternary operator in angular 
Javascript :: class element in javascript 
Javascript :: i18n react get current language 
Javascript :: Removing Service Workers Programmatically 
Javascript :: get dir from filepath javascript 
Javascript :: reactbootstrap multiselect 
Javascript :: javascript howdo i redirect-to another webpage 
Javascript :: emotion react 
Javascript :: add props to jsx element 
Javascript :: react scrollTop smooth 
Javascript :: javascript reset form 
Javascript :: how to merge two sorted arrays in javascript 
Javascript :: react native modal not full screen 
Javascript :: notice before reload js 
Javascript :: simple javascript code 
Javascript :: how to draw ellipse in javascript canvas 
Javascript :: user focus on tab javascript 
Javascript :: how to check if a javascript object is empty 
Javascript :: 0.1+0.2 javascript 
Javascript :: regex exact match case insensitive 
Javascript :: .includes( string 
Javascript :: select dropdown value using jquery 
Javascript :: check if string contains lowercase javascript 
Javascript :: how to use static file node js 
Javascript :: angular x social login 
Javascript :: js largest number in array 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =