Copy Text Program Code
<!DOCTYPE html>
<html>
<body>
<div align="center">
<p>Click "Copy Text" button to copy input text</p>
<input type="text" value="Hello World" id="myInput">
<button onclick="myFunction()">Copy Text</button>
</div>
<script>
function myFunction() {
var copyText = document.getElementById("myInput");
copyText.select();
copyText.setSelectionRange(0, 99999)
document.execCommand("copy");
alert("Copied the text: " + copyText.value);
}
</script>
</body>
</html>
Comments
Post a Comment