HTML:
<!-- The text field -->
<input type="text" value="Hello World" id="myInput">
<!-- The button used to copy the text -->
<button onclick="myFunction()">Copy text</button>
JAVASCRIPT:
function myFunction() {
/* Get the text field */
var copyText = document.getElementById("myInput");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */
/* Copy the text inside the text field */
navigator.clipboard.writeText(copyText.value);
/* Alert the copied text */
alert("Copied the text: " + copyText.value);
}
Code Example |
---|
Html :: disable close from screen modal popup |
Html :: html radio only one checked |
Html :: html date range input |
Html :: centre text |
Html :: autocomplete="off" |
Html :: change body font |
Html :: bootstrap form templates |
Html :: html.textboxfor add default value |
Html :: html image in table |
Html :: how to add a border around text in html |
Html :: go to id html |
Html :: html background color |
Html :: how to open files as super user ubuntu |
Html :: embed meta tag nextjs |
Html :: mysql dependency |
Html :: cache control html |
Html :: html date selector |
Html :: html scale svgö |
Html :: click on a button and start downloading data html |
Html :: iframe in html |
Html :: html css good button |
Html :: membuat footer html |
Html :: set file allow html |
Html :: html table link |
Html :: unmount ubuntu |
Html :: embed github html |
Html :: bootstrap soft corner |
Html :: how to insert a banner in html |
Html :: greater then less then in html text |
Html :: strong tag html |