I want to save an array from a table to clipboard. It could be compatible with excel. Is it possible to use execCommand()?
A small example:
<div style="display:inline-flex;">
<div id="11">
1
</div>
<div id="12">
2
</div>
</div>
<div style="display:inline-flex;">
<div id="21">
3
</div>
<div id="22">
4
</div>
</div>
<button id="save">Save</button>
<script>
var save = document.getElementById('save');
var a = document.getElementById('12');
var b = document.getElementById('22');
save.addEventListener('click', function () {
document.execCommand('copy',[a,b]);
});
</script>
Now i want to copy the arry to excel. That should be the result:
2| | |
------
4| | |