I have a text file that generates values from a form like this,
First Name: John
Last Name: Doe
I also want to upload a file which I do with file input and read with a FileReader, I am able to get all of the contents of the text file, but I only want to get parts after ':' as, John and Doe so I can write it in a span as
Username: John Doe
Is there a way to only read and write the parts after ':'?
This is what I tried but it writes all the values including First Name and Last Name,
var reader = new FileReader();
reader.onload = function (event) {
var contents = event.target.result;
document.getElementById("username").innerHTML = contents;
};
reader.readAsText(file);