Jump to content

Dr Pepper Can

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Dr Pepper Can

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I am using this widget to copy a list to the operating system's clipboard, to then paste it in an email message.The problem is, I the resulting list is not a list as much as it is a block of text.How can I better control the results?
  2. JMRKER was kind enough to improvise this solution below. However, although I need to have information (text) copied to the clipboard, I need NOT to have it in a textarea. It shouldn't be available for modification. Isn't there a way to keep this text data in the code, and then transferring it to the clipboard when a button is clicked? Thanks guys <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> <!-- From: https://stackoverflow.com/questions/6300213/copy-selected-text-to-the-clipboard-without-using-flash-must-be-cross-browser --> <style> </style> </head> <body> <textarea id="textarea" rows="6" cols="40"> Lorem ipsum dolor sit amet, eamsemper maiestatis no. </textarea><br/> <button id="copyTAreaBlock">Click to copy</button> <span id="copyTAreaAnswer"></span> <p> <input type="text" id="textInput"><br/> <button id="copyText">Click to copy</button> <span id="copyTextAnswer"></span> <script> // Setup the variables for TEXTAREA var textarea = document.getElementById("textarea"); var answer = document.getElementById("copyTAreaAnswer"); var copyTArea = document.getElementById("copyTAreaBlock"); copyTArea.addEventListener('click', function(e) { // Select some text (you could also create a range) textarea.select(); // Use try & catch for unsupported browser try { // The important part (copy selected text) var ok = document.execCommand('copy'); if (ok) answer.innerHTML = 'Copied!'; else answer.innerHTML = 'Unable to copy!'; } catch (err) { answer.innerHTML = 'Unsupported Browser!'; } }); </script> </body> </html>
  • Create New...