Created
July 12, 2019 03:19
-
-
Save crusj/4c0cccc4bef859672391bb6e0d0d4fab to your computer and use it in GitHub Desktop.
浏览器复制内容到剪切板
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var temp = $("<input type='text' value='" + mediaId + "'/>"); | |
temp.appendTo('body'); | |
temp.select();//选中元素 | |
if(document.execCommand('copy')){ | |
layer.msg('media_id已复制到剪切板!'); | |
}else{ | |
layer.msg('复制到剪切板失败!'); | |
} | |
temp.remove(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment