JSFiddle - React, Tailwind, and code Playground

by webdevhelp

HTML

<div id="text">Этот текст будет скопирова в буфер обмена</div>
<br>
<button id="copy">Копировать текст</button>

JavaScript

$('#copy').click(function() {
	    var $temp = $("<input>");
	    $("body").append($temp);
	    $temp.val($('#text').text()).select();
	    document.execCommand("copy");
	    $temp.remove();

	    $(this).text('Тест скопирован!');
	});