1 回答

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
你的復(fù)制的按鈕用class來寫
<input class='copy_item' id='copy_item1' readonly value='你要復(fù)制的值' style='border: none;background:none;box-shadow: none;width: auto;' />
點(diǎn)擊復(fù)制
js如下
var doms = [];
$('.copy-btn').each(function() {
doms.push(this);
});
var clip = new ZeroClipboard(doms);
//設(shè)置aftercopy事件讓復(fù)制成功后彈窗提示
clip.on('aftercopy', function() {
alertx('復(fù)制成功');
});
clip.on('error', function (event) {
$this.hide().before(event.message);
ZeroClipboard.destroy();
});
添加回答
舉報(bào)