copyme

1.0.5 • Public • Published

Copy Me

The Copy Me is a simple JS code which allows you to add a copy event to your code for easy copy in your website or webapp.

How It Works

  • Add the <script src="copyMe.min.js"></script> to your HTML file

  • Create any element you want to copy from giving it an id.

    • E.g <div id='copyMe'>The text here will be copied</div>
  • Create an eventListener on an element that alters the copy Event with a specific id

    • E.g <button id='copy'>Copy</button>


Add This to your JS file

In your js file, add an eventListener listening your element (e.g the button) either (click, mouseover, contextmenu....) . Then call the copyToClipboard() function taking the id of the item(#copyMe) you want to copy as the parameter.

Sample Code

document.querySelector('#copy').addEventListener('click', function(){
   copyToClipboard(document.querySelector('copyMe'))
});

OR

Use Source Code Here.

But you need to follow Add This to your JS file step

Readme

Keywords

Package Sidebar

Install

npm i copyme

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

2.25 kB

Total Files

3

Last publish

Collaborators

  • qudusayo