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?
- How can I scroll to an element using jQuery?
- Remove CSS class from element with JavaScript (no jQuery) [duplicate]
- What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]
- Make div scrollable
- Vertical Text Direction
- Bootstrap Dropdown menu is 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 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?
- Why “Inline-block” doesn’t work properly in this CSS?
- How to fix a footer overlapping content?
- What’s the HTML to have a horizontal space between two objects?
- HTML/CSS float: left; is not working properly
- Textarea Auto height
- How to get current screen width in CSS?
- margin-right is not working with my HTML. How can I center my content?
- how to center an inline div using css?
- Force div to be topmost element of any and all webpages
- How to have an anim gif on a link and play it on hover and reset
- Set bootstrap modal body height by percentage
- Failed to decode downloaded font
- Center HTML Input Text Field Placeholder
- how to display a div triggered by onclick event
- creating a chevron in CSS
- jQuery scrollTop() method not working
- JavaScript – Count Number of Visitor for Website
- How to make fixed header table inside scrollable div?
- Cannot read property ‘style’ of undefined — Uncaught Type Error
- How to make HTML element resizable using pure Javascript?
- How can I center
- into a div?
- How to align this span to the right of the div?
- How do I clear the content of a div using JavaScript?
- WordPress Admin Bar Overlapping Twitter Bootstrap Navigation [closed]
- HTML / Javascript in custom field textarea?
- How to solve ‘Eliminate render-blocking JavaScript and CSS in above-the-fold’ content for multiple files?
- Collapsible button inside a ul list does work in jsfiddle but not in WP
- Relative path instead of absolute for wp_enqueue_script
- Handling URLs in WordPress application
- Can “ and “ tags be used in the HTML editor?
- JavaScript added as link/stylesheet
- CSS style button For WP Login Function in page template
- How can i add note, caution, warning quote inside the text? [closed]
- Eliminate render-blocking JavaScript and CSS in above-the-fold content
- how to setup content on a static frontpage with css and xhtml
- Implementing a simple slider in code?
- Google yolo one tab signup plugin avilable in wordpress? [closed]
- Disable File Editing function
- Get post format and use it as a CSS class in different spans
- HTML email sent with wp_mail shows plain text
- custom header navigation has odd spacing [closed]
- Conditionally enqueue a stylesheet based off of a javascript click event
- ACF Pro with SlickJS [closed]
- Link to page with posts of specific type
- Show/Hide Div for Login Mask
- How to avoid repeating similar properties for all tds of a table in a wordpress post
- WordPress Rest Api access the header and extract stylesheets URL
- How to make a function to play only on the home page?
- Where to add this code for a Modal box to work? [closed]
- Overriding inline !important CSS with Javscript code snippet with media query
- Getting and setting CSS variables with JQuery in WordPress backend fails
- Getting click on item to open closest relevant element (popup) with jQuery
- how to modify html on homepage (no home-page.php in my theme)
- Hide CSS class only in single post pages
- current menu item hover not working?
- Page flickers when new html5 video loads
- Target a specific container to style on WordPress storefront theme
- Creating a simple button inside of a widget
- Css style removed but still showing via CDN even after clearing browser cache and purging all caches for site
- Move text from the side of image to below image [closed]
- My contact form is not being responsive
- I cannot make this position properly in WordPress [closed]
- Possible jquery / library conflict in plugin usage
- How to include backend buttons css on frontend?
- Add HTML input tag to to site navigation
- What can cause JavaScript and CSS files to be minified?
- I need css code to divide my webpage sections into two columns
- How to add input search field with roudned corners?
- How do I add JS and CSS to WP (Flatsome)
- “Plate” theme broken after update