How to copy to clipboard with one click using jquery

一个新手
Release: 2017-09-29 09:56:13
Original
1934 people have browsed it


今天做项目有一个功能,通过点击事件复制一段文本到剪切板,在网上找了一些,整理了一下,方便需要的朋友使用。

复制文本$(function(){
var clipboard = new Clipboard('#copy',{

text: function(trigger) {

alert("复制成功!");

return trigger.getAttribute('data-text');

}

});
});

Copy after login

The above is the detailed content of How to copy to clipboard with one click using jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!