{"id":25535955,"url":"https://github.com/assisfery/copypastejs","last_synced_at":"2025-04-11T14:34:14.210Z","repository":{"id":57207332,"uuid":"219487736","full_name":"assisfery/CopyPasteJS","owner":"assisfery","description":"This a small JS library to execute clipboard functions in a fast and easy way.","archived":false,"fork":false,"pushed_at":"2020-03-10T18:25:17.000Z","size":38,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T12:18:49.978Z","etag":null,"topics":["clipboard","copy-paste","copy-to-clipboard","javascript","javascript-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/assisfery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-04T11:40:19.000Z","updated_at":"2024-07-27T20:22:47.000Z","dependencies_parsed_at":"2022-09-08T17:01:06.594Z","dependency_job_id":null,"html_url":"https://github.com/assisfery/CopyPasteJS","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assisfery%2FCopyPasteJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assisfery%2FCopyPasteJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assisfery%2FCopyPasteJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assisfery%2FCopyPasteJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/assisfery","download_url":"https://codeload.github.com/assisfery/CopyPasteJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248419816,"owners_count":21100254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clipboard","copy-paste","copy-to-clipboard","javascript","javascript-library"],"created_at":"2025-02-20T04:24:33.106Z","updated_at":"2025-04-11T14:34:14.191Z","avatar_url":"https://github.com/assisfery.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n##  CopyPasteJS\n\nThis a small JS library to execute clipboard functions in a fast and easy way.\n\n[![](https://data.jsdelivr.com/v1/package/gh/assisfery/CopyPasteJS/badge)](https://www.jsdelivr.com/package/gh/assisfery/CopyPasteJS)\n[![](https://img.shields.io/badge/npm-copypastejs-green)](https://www.npmjs.com/package/copypastejs)\n\n\n### Demo\nSee the demo here: [https://assisfery.github.io/CopyPasteJS/index.html](https://assisfery.github.io/CopyPasteJS/index.html)\n\n\n### Repositorys\nGithub repository: https://github.com/assisfery/CopyPasteJS\n\nCDN repository: https://www.jsdelivr.com/package/gh/assisfery/CopyPasteJS\n\nNPM repository: https://www.npmjs.com/package/copypastejs\n\n\n### Get Start\nJust import the  **src/CopyPasteJS.js**  file in your document.\n```html\n\u003cscript src=\"src/CopyPasteJS.js\"\u003e\u003c/script\u003e\n```\n\nThis file is hosted in CDN JSDelivr.\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/assisfery/CopyPasteJS@1.2/src/CopyPasteJS.min.js\"\u003e\u003c/script\u003e\n```\n\nOr you can get it using NPM repository.\n```\nnpm i copypastejs\n```\n\n### Copy Text - From Input Element\nTo copy data from a input element just add  **data-copy-origin=\"#element\"**  attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-copy-origin=\"#txtCopy\"\u003eCopy\u003c/button\u003e\n```\n\n### Copy Text - From Nowhere\nTo copy text to clipboard  **data-copy-text=\"text\"**  attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-copy-text=\"Some text\"\u003eCopy\u003c/button\u003e\n```\n\n### Copy Text - From Others Element\nTo copy text to clipboard from a html element just include **data-copy-text=\"text\"** attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-copy-origin=\"#element\"\u003eCopy\u003c/button\u003e\n```\n\n### Paste Text\nTo paste data to a input element just add  **data-paste-target=\"#element\"**  attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-paste-target=\"#txtPaste\"\u003ePaste\u003c/button\u003e\n```\n\n### Cut Text\nTo cut data from a input element just add  **data-cut-origin=\"#element\"**  attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-cut-origin=\"#txtCut\"\u003eCut\u003c/button\u003e\n```\n\n### Copy and Paste Text\nTo copy and paste data from a input element to another just add  **data-copy-origin=\"#element\"**  and  **data-paste-target=\"#element\"**  attributes to the button.\n```html\n\u003cbutton class=\"btn btn-success\"\ndata-copy-origin=\"#txtCopy2\"\ndata-paste-target=\"#txtPaste2\"\u003eCopy and Paste\u003c/button\u003e\n```\n\n### Copy Callback function\nAfter data is been copied if you want to execute a function just add  **data-copy-callback=\"jscode()\"**  attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-copy-origin=\"#txtCopy3\" data-copy-callback=\"alert('copied')\"\u003eCopy and Callback\u003c/button\u003e\n```\n\n### Paste Callback function\nAfter data is been pasted if you want to execute a function just add  **data-paste-callback=\"jscode()\"**  attribute to the button.\n```html\n\u003cbutton class=\"btn btn-success\" data-paste-target=\"#txtPaste3\" data-paste-callback=\"alert('pasted')\"\u003ePaste and Callback\u003c/button\u003e\n```\n\n### JavaScript Utils\nYou can do all those actions in JavaScript code.\n\n#### Copy Text in JavaScript\n```js\nCopyPasteJS.copyText(\"Text copied in JS\");\n```\n\n#### Copy Text in JavaScript and Callback Function\n```js\nCopyPasteJS.copyText(\"Text copied in JS and Callback triggered\", function(){\n\talert(\"Yes its done\");\n});\n```\n\n#### Copy Value From Element in JavaScript\n```js\nCopyPasteJS.copyFrom(\"#txtCopy4\");\n\n// OR USE CALLBACK\nCopyPasteJS.copyFrom(\"#txtCopy4\", function(){\n\talert(123);\n});\n```\n\n#### Paste To Element in JavaScript\n```js\nCopyPasteJS.pasteTo(\"#txtPaste4\");\n\n// OR CALL A FUNCTION\nCopyPasteJS.pasteTo(\"#txtPaste4\", function(){\n\talert(\"I fell amazing\");\n});\n```\n\n##### Cut Value From Element in JavaScript\n```js\nCopyPasteJS.cutFrom(\"#txtCut2\");\n\n// OR CALL A FUNCTION\nCopyPasteJS.cutFrom(\"#txtCut2\", function(){\n\talert(\"I fell amazing\");\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassisfery%2Fcopypastejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassisfery%2Fcopypastejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassisfery%2Fcopypastejs/lists"}