JSFiddle - React, Tailwind, and code Playground

by Gourav Singh

HTML

<input type="file" id="myFile"/>

JavaScript

$("#myFile").change(function(){
    alert('xyz');
    readURL(this);
});


function readURL(input) {

    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {
            console.log(reader);
            alert(e.target.result);
        }

        //reader.readAsDataURL(input.files[0]);
    }
}