blob: dc32149207f3bb285b36ff0eeab66d0c4583640e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function copytext() {
var Text = document.getElementById("text");
Text.select();
navigator.clipboard.writeText(Text.value);
}
function download(filename, textInput) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8, ' + encodeURIComponent(textInput));
element.setAttribute('download', filename);
document.body.appendChild(element);
element.click();
}
document.getElementById("save").addEventListener("click", function() {
var text = document.getElementById("text").value;
var filename = "output.txt";
download(filename, text);
}, false);
|