Quantcast
Channel: User Oswald - Stack Overflow
Viewing all articles
Browse latest Browse all 36

Answer by Oswald for Text file reading and handling in JavaScript

$
0
0

EventTarget.addEventListener expects a function as second argument.

You pass readFile() as the second argument. readFile() is not a function. It's the result of calling the function readFile. When you call that function (to pass its result to EventTarget.addEventListener), this.files[0] is undefined, because this still references the global object, which does not have a files property.

Pass readFile as second argument to EventTarget.addEventListener, instead of readFile().


Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>