Here is a simple example from w3 schools that uses a bit of JS to copy the value of a input field.
<input type="text" value="StackExchange WordPress" id="myInput">
<button onclick="myFunction()">Copy text</button>
<p>The document.execCommand() method is not supported in IE9 and earlier.</p>
<script>
function myFunction() {
var copyText = document.getElementById("myInput");
copyText.select();
document.execCommand("Copy");
alert("Copied the text: " + copyText.value);
}
</script>
Source found here: w3schools
Related Posts:
- How to place Text and an Image next to each other in HTML?
- Align text to the bottom of a div
- Text wrapping around a div
- Write text below a specific part of a sentence
- How to insert html/css/javascript code to wordpress plugin
- How to integrate my HTML and javascript into my child theme
- How to create fa-bars animated menu
- How can I get the search form to be selected automatically?
- Cannot set property ‘className’ of null at setThemeFromCookie
- prevent HTML output if custom field is empty [closed]
- Hide Tab Titles from Tabs Block
- Unable to use Datepicker in a table when inserting a row
- How to properly hide the div of an inline collapsible button?
- How would I add this code to a single WordPress page?
- Trouble with adding preloader to my home page index.html and index.js
- Import HTML code that loads css and javascript into specific page
- Interactive maps in wordpress
- Can I upload my HTML/CSS/Javascript game onto a WordPress page?
- Identify and style the paragraph beginning w/o a class: based on a combination of common characters (CSS, JS)
- How am I supposed to use index.html?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- Failed to load resource: the server responded with a status of 404 (Not Found)
- CSS Background Opacity [duplicate]
- Making a
- How to align a to the middle (horizontally/width) of the page [duplicate]
- Is there a color code for transparent in HTML?
- multiple classes on single element html
- How can I scroll to an element using jQuery?
- Remove CSS class from element with JavaScript (no jQuery) [duplicate]
- Set cookie and get cookie with JavaScript
- How to insert spaces/tabs in text using HTML/CSS
- What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]
- How to get these two divs side-by-side?
- Is there a color code for transparent in HTML?
- Bootstrap Dropdown menu is not working
- How to place a text next to the picture?
- Change Background color (css property) using Jquery
- “Stray start tag footer” in html validator?
- Make div scrollable
- CSS no text wrap
- How to make the HTML link activated by clicking on the
- ?
- Set timeout for ajax (jQuery)
- How to change text transparency in HTML/CSS?
- How does the data-toggle attribute work? (What’s its API?)
- CSS height 100% percent not working
- How to change css property using javascript
- Use images like checkboxes
- JavaScript Loading Screen while page loads
- Completely disable scrolling of webpage
- Vertical Text Direction
- HTML Width Percentage
- Bootstrap Dropdown menu is not working
- Text-decoration: none not working
- Bootstrap Dropdown menu is not working
- right align an image using CSS HTML
- Indent starting from the second line of a paragraph with CSS
- How can I replace text with CSS?
- Why are my CSS3 media queries not working on mobile devices?
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- Full-screen iframe with a height of 100%
- How to completely remove borders from HTML table
- How do I right align div elements?
- How to print HTML content on click of a button, but not the page?
- Check if an element contains a class in JavaScript?
- Bootstrap 4 Dropdown Menu not working?
- Why “Inline-block” doesn’t work properly in this CSS?
- Why is the jquery script not working?
- How to fix a footer overlapping content?
- How to word wrap text in HTML?
- How would you make two
s overlap?- What’s the HTML to have a horizontal space between two objects?
- How to center HTML5 Videos?
- Text border using css (border around text)
- HTML/CSS float: left; is not working properly
- Textarea Auto height
- height style property doesn’t work in div elements
- How to get current screen width in CSS?
- CSS “margin: 0 auto” not centering
- margin-right is not working with my HTML. How can I center my content?
- how to center an inline div using css?
- How to center HTML5 Videos?
- Why is marquee deprecated and what is the best alternative?
- Refresh/reload the content in Div using jquery/ajax
- How to write inside a DIV box with javascript
- How can I insert vertical blank space into an html document?
- Making text background transparent but not text itself
- How to get height of div in px dimension
- HTML span align center not working?
- Crop the image using JavaScript
- Why write script type=”text/javascript” when the mime type is set by the server?
- Force div to be topmost element of any and all webpages
- Retrieve the position (X,Y) of an HTML element
- How to display raw JSON data on a HTML page
- How to have an anim gif on a link and play it on hover and reset
- Align