使用javascript操作剪贴板,复制,剪切和粘贴。

ganzw 527fe4261e feat modify readme 8 years ago
build 9fe80176d2 feat first commit 8 years ago
src 9fe80176d2 feat first commit 8 years ago
test 085a9e8dfe feat add test 8 years ago
.gitignore 9fe80176d2 feat first commit 8 years ago
LICENSE a7342d1193 Initial commit 8 years ago
README.md 527fe4261e feat modify readme 8 years ago
clipBoard.min.js 9fe80176d2 feat first commit 8 years ago

README.md

clipBoard.js

with javascript operating clipboard, copy、cut and paste.

support

copy cut paste
chrome ×
Firefox ×
IE7+

methods

copy

var copy = new clipBoard(document.getElementById('data'), {
	beforeCopy: function() {
		
	},
	copy: function() {
		return document.getElementById('data').value;
	},
	afterCopy: function() {

	}
});

copy will be called automatic, if you want call by yourself, you can do like this

var copy = new clipBoard(document.getElementById('data'));
copy.copyd();

document.getElementById('data') is the value target, you can also use it with jquery $('#data')

cut

it same to copy

var cut = new clipBoard(document.getElementById('data'), {
	beforeCut: function() {
		
	},
	cut: function() {
		return document.getElementById('data').value;
	},
	afterCut: function() {

	}
});

or

var cut = new clipBoard(document.getElementById('data'));
cut.cut();

paste

var paste = new clipBoard(document.getElementById('data'), {
	beforePaste: function() {
		
	},
	paste: function() {
		return document.getElementById('data').value;
	},
	afterPaste: function() {

	}
});

or

var paste = new clipBoard(document.getElementById('data'));
paste.paste();

document.getElementById('data') is the paste target, you can also use it with jquery $('#data')

NEW ISSUE