This time I will share jQuery Plugin and tutorial about jQuery Plugin To Copy/Paste/Select Text – jQlipboard, hope it will help you in programming stack.
jQlipboard is a simple jQuery clipboard plugin for handling copy, paste, and select (highlight) events on the web app.
How to use it:
1. Load the main script JQlipboard.js
after jQuery.
1 |
< script src = "/path/to/cdn/jquery.slim.min.js" ></ script > |
2 |
< script src = "/path/to/JQlipboard.js" ></ script > |
2. Copy any string to the clipboard.
1 |
$.copy( "Any String Here" ); |
3. Or copy text within a container element.
1 |
< div id = "demo" >This text will be coppied</ div > |
4. Or copy text you typed in a text field.
02 |
< input type = "text" id = "demo" /> |
10 |
< button id = "myBtn" >Click Me To Copy</ button > |
1 |
$( "#myBtn" ).click( function (){ |
2 |
var str = $( "#demo" ).val(); |
5. It also provides a functionality to select & highlight text within a container element.
1 |
< div id = "demo" >This text will be coppied</ div > |
6. Determine when the page will request permession to use the clipboard:
- when needed (default)
- immediate
2 |
permissionPrompt: "when needed" |
7. Determine when the page will alert the user that they have not given their permission to access the clipboard:
- when needed (default)
- immediate
- never
2 |
permissionAlert: "when needed" |
8. Determine whether to detect when you modify the clipboard on your own and to adjust the functions accordingly. Default: false.
Changelog:
2021-03-20
2020-11-15
2020-11-02
2020-10-31