jQuery Plugin To Copy/Paste/Select Text - jQlipboard

jQuery Plugin To Copy/Paste/Select Text - jQlipboard
File Size: 11.4 KB
Views Total: 75
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

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.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/JQlipboard.js"></script>

2. Copy any string to the clipboard.

$.copy("Any String Here");

3. Or copy text within a container element.

<div id="demo">This text will be coppied</div>
$('#demo').copy();

4. Or copy text you typed in a text field.

<!-- Input Field -->
<input type="text" id="demo" />

<!-- Or Textarea -->
<textarea id="demo">
  ...
</textarea>

<!-- Copy Button -->
<button id="myBtn">Click Me To Copy</button>
$("#myBtn").click(function(){
  var str = $("#demo").val();
  $.copy(str)
});

5. It also provides a functionality to select & highlight text within a container element.

<div id="demo">This text will be coppied</div>
$('#demo').select();

6. Determine when the page will request permession to use the clipboard:

  • when needed (default)
  • immediate
$.jQlipboard({
  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
$.jQlipboard({
  permissionAlert: "when needed"
})

8. Determine whether to detect when you modify the clipboard on your own and to adjust the functions accordingly. Default: false.

$.jQlipboard({
  copyListener: true
})

This awesome jQuery plugin is developed by DiriectorDoc. For more Advanced Usages, please check the demo page or visit the official website.