如何使用JQuery / Javascript在剪贴板中复制文本 [英] How to copy text in Clipboard using JQuery/Javascript
本文介绍了如何使用JQuery / Javascript在剪贴板中复制文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$( 。mydivclass)。live(< span class =code-string>' click',function(e){
// 设置路径
ZeroClipboard.setMoviePath(' ZeroClipboard.swf');
// 创建客户
var clip = new ZeroClipboard.Client();
clip.setText(heading);
// 将其粘贴到按钮
clip.glue(' mydivid');
});
我正在尝试使用上面的代码从网站(在Firefox上)复制文本,但不是复制点击.. : - (
解决方案
( 。mydivclass)。live( click,function(e){
// 设置路径
ZeroClipboard.setMoviePath(' ZeroClipboard.swf'跨度>);
// 创建客户
var clip = new ZeroClipboard.Client();
clip.setText(heading);
// 将其粘贴到按钮
clip.glue (' mydivid');
});
我试图使用上面的代码从网站(在Firefox上)复制文本,但不是复制点击..: - (
Hello Neeraj,
参考这里
http://stackoverflow.com/questions/7713182/copy-to-clipboard-for -all-browsers-using-javascript [ ^ ]
所有最佳:)
ZeroClipboard.setDefaults({moviePath: ZeroClipboard-master / ZeroClipboard.swf})
$(".mydivclass").live('click', function (e) {
//set path
ZeroClipboard.setMoviePath('ZeroClipboard.swf');
//create client
var clip = new ZeroClipboard.Client();
clip.setText(heading);
//glue it to the button
clip.glue('mydivid');
});
I am trying to copy text from a website (on firefox) using above code but its not copying on click..:-(
解决方案
(".mydivclass").live('click', function (e) { //set path ZeroClipboard.setMoviePath('ZeroClipboard.swf'); //create client var clip = new ZeroClipboard.Client(); clip.setText(heading); //glue it to the button clip.glue('mydivid'); });
I am trying to copy text from a website (on firefox) using above code but its not copying on click..:-(
Hello Neeraj,
Refer here
http://stackoverflow.com/questions/7713182/copy-to-clipboard-for-all-browsers-using-javascript[^]
All the Best:)
ZeroClipboard.setDefaults({ moviePath: "ZeroClipboard-master/ZeroClipboard.swf" })
这篇关于如何使用JQuery / Javascript在剪贴板中复制文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文