标签:javascrip bank error text min 失败 复制 target err
引入一个clipboard.js文件即可使用,下载地址:https://github.com/zenorocha/clipboard.js
<script type="text/javascript" src="/UI/scripts/clipboard.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.min.js"></script>
$(document).ready(function () {
if ($(".btnCopy").length > 0) {
var clipboard = new ClipboardJS(‘.btnCopy‘);
//clipboard.on(‘success‘, function (e) {
// console.log(e);
// alert("测试复制成功!")
//});
//clipboard.on(‘error‘, function (e) {
// console.log(e);
// alert("测试复制失败!请手动复制")
//});
}
});
页面:
<span id="PayeeName">1111</span><input type="button" class="btnCopy" data-clipboard-action="copy" data-clipboard-target="#PayeeName" value="复制" />
<span id="bankName">222</span><input type="button" class="btnCopy" data-clipboard-action="copy" data-clipboard-target="#bankName" value="复制" />
标签:javascrip bank error text min 失败 复制 target err
原文地址:https://www.cnblogs.com/cathyxiao/p/9829419.html