Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<textarea id="textarea" placeholder="Here type some text"></textarea>
<button id="create">Create file</button>
<a download="file.txt" id="download_link" style="display: none">Download</a>
<script>
(function () {
var textFile = null,
makeTextFile = function (text) {
var data = new Blob([text], {type: 'text/plain'});
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
return textFile;
};
var create = document.getElementById('create'),
textarea = document.getElementById('textarea');
create.addEventListener('click', function () {
var link = document.getElementById('download_link');
link.href = makeTextFile(textarea.value);
link.style.display = 'block';
}, false);
})();
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507