Clipboard.js实现复制内容到剪切板

<script type="text/javascript">
var clipboard1 = new Clipboard('.bt01');
clipboard1.on('success', function (e) {
alert("Copy Url Success!");
e.clearSelection();
});

</script>

<div class="mt5"><img src="../../Images/pdf1.png" class="inline-any"><input type="text" id="hid01" width="100px" value="@ViewBag.Url1" />                                                 
                <input type="button" value="Copy url" class="btn1 inline-any bt01" data-clipboard-action="copy"   data-clipboard-target="#hid01" /></div>

要先添加Clipboard.js的引用

你可能感兴趣的:(Clipboard.js实现复制内容到剪切板)