jq 点击按钮复制内容
- input 方式复制内容
var temp = $("<input>");
$("body").append(temp);
temp.val($('#'+id).val()).select();
document.execCommand("copy");
temp.remove();
- textarea 方式复制内容(可以带上换行等格式)
var temp = $("<textarea>");
$("body").append(temp);
console.log($('#trackingnumber').html());
temp.val($('#trackingnumber').html()).select();
document.execCommand("copy");
temp.remove();