I'm making a grammar check website using flask, when I reset the textarea by using the reset button, it allows me to upload the file but it does not display the content in that text file.
document.getElementById('myFile').addEventListener('change', function() {
var fr = new FileReader();
fr.onload = function() {
document.getElementById('txt1').textContent = fr.result;
}
fr.readAsText(this.files[0]);
})
<div class='text-content'>
<legend>Enter Your Text</legend>
<textarea id="txt1" name="text" rows="50" cols="30" autofocus required placeholder="Either type text manually or upload .txt file. ONLY 500 CHARACTER LIMIT." value="">{{sample_input}}</textarea>
<div id="content">
<input id="myFile" name="myFile" type="file" style="font-size:15px; " />
<button type="submit" value="Submit" onclick="javascript:loading();">Check Grammar Here</button>
<button id="btn" onclick="javascript:eraseText();" style="display: inline"> Reset </button>
</div>
</div>