JSFiddle - React, Tailwind, and code Playground

by Riccal

HTML

<input type="file" id="file">
<br />
<div id="preview">This Part of the HTML will be replaced with your image</div>

JavaScript

$(window).load(function(){
/* image preview */
$('#file').change(function(){
    var oFReader = new FileReader();
    oFReader.readAsDataURL(this.files[0]);
    console.log(this.files[0]);
    oFReader.onload = function (oFREvent) {
        $('#preview').html('<img src="'+oFREvent.target.result+'">');
    };
});
 
});