Q:

Javascript Program to Copy the Text

0

Program to Copy the Text of an input field using javascript.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<html>
<body>

<p>Program to copy the text of an input field.<p>

<input type="text" id="InputValue" Value="Hello TutorialsLink!">
<button onclick="Function()">Copy text</button>

<script>
function Function() {
  var copiedthetext = document.getElementById("InputValue");
  copiedthetext.select();
  document.execCommand("Copy");
  alert("Copied the text: " + copiedthetext.value);
}
</script>

</body>
</html>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now