Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy to clipboard?
#3
(04-23-2018, 03:22 AM)cpstevenc Wrote: Using 14.2.7 with Tokyo Update 3 , HTTPS enabled.

I have a TIWLabel , that uses RawText = true, which for now is named ( and friendly name) lbl_NumberText

I want to be able to copy the text inside this to the clipboard.

I already know this is tricky in itself, depending on Browser... browser version... http vs https.

Using this as an example @ https://www.w3schools.com/howto/howto_js...pboard.asp

I use the onClick ScriptEvent on a button do just do the javascript code


Code:
var copyText = document.getElementById("lbl_NumberText");
    copyText.select();
    document.execCommand("Copy");
    alert("Copied the text: " + copyText.value);

This appears to not work as it never gets to the "alert" section .... I assume the script code is aborting as I am sure "lbl_NumberText" for getElementById is not quite correct.

Instead of the .FriendlyName, try using .Name.

The control id is what you're looking for.  When I look at the DOM, that shows .Name in the id.

Dan
Reply


Messages In This Thread
Copy to clipboard? - by cpstevenc - 04-23-2018, 03:22 AM
RE: Copy to clipboard? - by mhammady - 04-23-2018, 04:06 AM
RE: Copy to clipboard? - by cpstevenc - 04-23-2018, 02:20 PM
RE: Copy to clipboard? - by DanBarclay - 04-23-2018, 04:06 AM
RE: Copy to clipboard? - by kudzu - 04-23-2018, 04:49 PM
RE: Copy to clipboard? - by cpstevenc - 04-23-2018, 06:05 PM
RE: Copy to clipboard? - by DanBarclay - 04-23-2018, 10:41 PM
RE: Copy to clipboard? - by Jose Nilton Pace - 04-24-2018, 02:30 PM
RE: Copy to clipboard? - by cpstevenc - 04-24-2018, 08:49 PM
RE: Copy to clipboard? - by Jose Nilton Pace - 04-24-2018, 09:34 PM
RE: Copy to clipboard? - by kudzu - 04-25-2018, 03:16 PM
RE: Copy to clipboard? - by cpstevenc - 04-30-2018, 02:20 AM
RE: Copy to clipboard? - by DanBarclay - 05-01-2018, 01:40 AM
RE: Copy to clipboard? - by kudzu - 04-30-2018, 01:43 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)