Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kennethkalmer/jquery-copyfriendly

Unobtrusive jQuery plugin to place the text of any element in an invisible text field, making sure no unnecessary whitespace is copied with to the clipboard
https://github.com/kennethkalmer/jquery-copyfriendly

Last synced: about 15 hours ago
JSON representation

Unobtrusive jQuery plugin to place the text of any element in an invisible text field, making sure no unnecessary whitespace is copied with to the clipboard

Awesome Lists containing this project

README

        

h1. jQuery copyfriendly

A simple jQuery plugin that extracts the text from an HTML element and places it into an "invisible" text field. This makes selecting and copying the text much easier since no surrounding whitespace is copied by the browser.

The plugin works unobtrusively, so nothing happens in the absense of Javascript.

h2. Usage

Include jquery.copyfriendly.js as fire it off like this:



$(document).ready(function(){
$('.copyme').copyfriendly();
});

Then mark your required elements with the specified class:




Hello


Or



Heya

h2. Options

copyfriendly() takes on parameter currently, which is optional:



copyfriendly( {
klass: "borderless"
} );

The 'klass' option tells copyfriendly which CSS class to apply to the inputs generated.

h2. Sample CSS

You can make the inputs generated by copyfriendly invisible using this sample CSS:



input.borderless {
border: none;
}

Do be warned that it might take a little more to align the appearance of the remaining text with the surrounding text in the document.

h2. License

(MIT LICENSE) in LICENSE.txt