[program-l] Re: A Button That Copies Code To The Clipboard

  • From: "Lewis Wood" <lewislwood@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 09:09:55 -0600

Just look up javascript and attach it to a clipboard.

 

For example:

Just place the following code in your function a call it from the button:

n

 

 

        navigator.clipboard.writeText(textarea.text)

 

 

Here is the reference:

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard

 

Browsers provide the api. 

 

Lewis Wood

lewislwood@xxxxxxxxx <mailto:lewislwood@xxxxxxxxx

 

 

 

From: program-l-bounce@xxxxxxxxxxxxx <program-l-bounce@xxxxxxxxxxxxx> On
Behalf Of Jim Homme
Sent: Tuesday, November 8, 2022 8:50 AM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] A Button That Copies Code To The Clipboard

 

Hi,

Does anyone know where to find instructions for making a button that copies
sample code to the clipboard?  I like the idea of putting that on a web
page.

 

Thanks.

 

Jim

 

==========

Jim Homme

Senior Digital Accessibility Consultant

Bender Consulting Services

412-787-8567

https://www.benderconsult.com/

Support the dreams of independence through employment for students with
disabilities with your Amazon purchases.

https://smile.amazon.com/ch/83-0988251

 

Other related posts: