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?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- CSS Background Opacity [duplicate]
- How to align a to the middle (horizontally/width) of the page [duplicate]
- Is there a color code for transparent in HTML?
- Set cookie and get cookie with JavaScript
- Is there a color code for transparent in HTML?
- Change Background color (css property) using Jquery
- “Stray start tag footer” in html validator?
- CSS no text wrap
- How to change css property using javascript
- Use images like checkboxes
- JavaScript Loading Screen while page loads
- Completely disable scrolling of webpage
- HTML Width Percentage
- Text-decoration: none not working
- Why are my CSS3 media queries not working on mobile devices?
- Why is the jquery script not working?
- How to word wrap text in HTML?
- How to center HTML5 Videos?
- Text border using css (border around text)
- How to center HTML5 Videos?
- HTML span align center not working?
- Setting a max character length in CSS
- Display Images Inline via CSS
- Why CSS3 Animation is not working?
- Change an image with onclick()
- Using margin / padding to space span tag from the rest of the p tag
- How to create a hidden
in JavaScript?
- How to expand textarea width to 100% of parent (or how to expand any HTML element to 100% of parent width)?
- How to make canvas responsive
- How to set “style=display:none;” using jQuery’s attr method?
- Local wordpress install only shows home page, all other pages Not Found
- WordPress Bootstrap Handburger Menu Wont Open
- Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- raw code vs wordpress
- Adding HTML to the Header, Screws up in IE7
- Does costum code in the root folder get lost when wordpress is updated?
- Firefox CSS Animations Broke [closed]
- Changing CSS FilePath for All Pages
- CSS Minification
- wordpress css file
- 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
- 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
- Plugins not showing up for custom template
- 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 click on item to open closest relevant element (popup) with jQuery
- Navigation menu disappears when I hover the mouse [closed]
- 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
- 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
- Outputting the blogposts or the_content()
- What can cause JavaScript and CSS files to be minified?
- I need css code to divide my webpage sections into two columns
- How do I add JS and CSS to WP (Flatsome)
- “Plate” theme broken after update
- IOS Ventura Safari 16.3 position fixed elements goes above scroll bar
- Elementor Contact Form Submit button has empty class
- How can I make one button a different color from the other buttons on my site?
- How can I highlight the active page using paginate_links()?
- My backround image in css is not showing
- Header menu permanently expanded in header responsive theme
- How do I remove/hide embed excerpts from posts