var textArea = document.createElement("textarea");
textArea.value = "123";
document.body.appendChild(textArea);
textArea.select();
document.execCommand("copy");
document.body.removeChild(textArea);
if (currentFocus) currentFocus.focus();
jquery
====
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
沒有留言:
張貼留言