blob: e3b3f92a24b801bee9403430ff042ff516c9fc28 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
const submitBtn = document.querySelector('#submit');
const fileInput = document.querySelector('#file');
const fileOutput = document.querySelector('#fileoutput');
fileInput.addEventListener('change', () => {
const reader = new FileReader();
reader.addEventListener('load', () => {
const text = reader.result;
if (fileOutput) {
fileOutput.value = text;
}
if (submitBtn) {
submitBtn.disabled = false;
}
});
reader.readAsText(fileInput.files[0]);
});
|