Auto Select And Copy Content In Text Field - jQuery Pick-text

File Size: 9.98 KB
Views Total: 813
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Auto Select And Copy Content In Text Field - jQuery Pick-text

Pick-text is a tiny jQuery plugin that automatically selects and copies content in an input field when clicked.

See Also:

How to use it:

1. Install & download the plugin via NPM.

# NPM
$ npm install @kanety/jquery-pick-text --save

2. Load the jQuery Pick-text plugin from the dist folder.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/dist/jquery-pick-text.js"></script>

3. Attach the plugin to the input field and done.

<input type="text" class="demo" value="Text To Select & Copy" />
$('.demo').on('click', function(e) {
  $(e.currentTarget).pickText();
});

4. Disable the Auto Copy while preserving the Auto Select functionality.

<input type="text" class="demo" value="Text To Select & Copy" />
$('.demo').on('click', function(e) {
  $(e.currentTarget).pickText({
    copy: false
  });
});

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