网页点击微信号自动复制跳转微信
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
<title>123</title>
</head>
<body>
微信号:<span id="target">12345678</span>
<button class="btn" data-clipboard-action="copy" data-clipboard-target="#target" id="copy_btn">
点击复制(id="target",如不单独显示微信按钮,可随意添加到任何地方)
</button>
</body>
<script>
$(document).ready(function(){
var clipboard = new Clipboard('#copy_btn');
clipboard.on('success', function(e) {
alert("微信号复制成功",1500);
window.location.href='weixin://';
e.clearSelection();
console.log(e.clearSelection);
});
});
</script>
</p>
</html>
<head>
<meta charset="UTF-8">
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
<title>123</title>
</head>
<body>
微信号:<span id="target">12345678</span>
<button class="btn" data-clipboard-action="copy" data-clipboard-target="#target" id="copy_btn">
点击复制(id="target",如不单独显示微信按钮,可随意添加到任何地方)
</button>
</body>
<script>
$(document).ready(function(){
var clipboard = new Clipboard('#copy_btn');
clipboard.on('success', function(e) {
alert("微信号复制成功",1500);
window.location.href='weixin://';
e.clearSelection();
console.log(e.clearSelection);
});
});
</script>
</p>
</html>