JavaScript
- 1 ответ
 - 0 вопросов
 
    1
    Вклад в тег
    
      
      
    
  
  
function copyToClipboard(value) {
    var prev_focus = document.activeElement;
    var area = document.createElement('textarea');
    area.value = value;
    document.body.appendChild(area);
    area.focus();
    area.select();
    area.setSelectionRange(0, 99999); /* For mobile devices */
    document.execCommand('copy');
    document.body.removeChild(area);
    if (prev_focus) {
        prev_focus.focus();
    }
}