// //点击复制
$('#copyCode').click(function () {
let transfer = document.createElement('input');//创建控件
document.body.appendChild(transfer);
transfer.style.cssText = 'position: absolute;right: 45%;top: 80%;'
transfer.value = $('#billCode').html(); // 这里表示想要复制的内容
transfer.focus();
transfer.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
}
transfer.blur();
// console.log('复制成功');
document.body.removeChild(transfer);//删除控件
})
js点击复制功能
最新推荐文章于 2024-04-12 18:31:57 发布