使用jQuery單擊按鈕復(fù)制到剪貼板如何將div中的文本復(fù)制到剪貼板上?我有一個(gè)div,需要添加一個(gè)鏈接,將文本添加到剪貼板。有解決辦法嗎?<p class="content">Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p><a class="copy-text">copy Text</a>單擊“復(fù)制文本”后,然后按克特 + V它必須粘在一起。
3 回答

Qyouu
TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超11個(gè)贊
<button id='markup-copy'>Copy Button</button><script> document.getElementById('markup-copy').addEventListener('click', function() { clipboard.copy({ 'text/plain': 'Markup text. Paste me into a rich text editor.', 'text/html': '<i>here</i> is some <b>rich text</b>' }).then( function(){console.log('success'); }, function(err){console.log('failure', err); }); });</script>
添加回答
舉報(bào)
0/150
提交
取消