<input type="text" value="тестовое значение">
<button id="copy">Скопировать</button>
<script>
copy.onclick = function () {
var range = document.createRange();
range.selectNode(document.querySelector('input'));
window.getSelection().addRange(range);
try {
document.execCommand('copy');
} catch(err) {
console.log('Can`t copy, boss');
}
window.getSelection().removeAllRanges();
}
</script>