一鍵複製 execCommand(“copy”)

ABAB←↓↑→
1 min readSep 30, 2020
$('button.url_token').click(function(){   var selection = document.getSelection();   var range = document.createRange();   range.selectNode( this.previousElementSibling);   selection.removeAllRanges();   selection.addRange(range);   document.execCommand('copy')   selection.removeAllRanges();});

必須要顯示的欄位才可以複製到內容

解法:
https://stackoverflow.com/questions/47879184/document-execcommandcopy-not-working-on-chrome?rq=1

--

--