JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<body>
<div id="outter">
<div id="selectionBox">
<form id="qqqq" enctype="multipart/form-data" action="/" method="post">
<input id="fileSelect" type="file" name="imagePP" accept="image/x-png, image/gif, image/jpeg, image/bmp">
</form>
</div>
</div>
</body>
JavaScript
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
if (!$("#aaa").length) {
$("#outter").append("<img id=\"aaa\">");
}
$("#aaa").attr('src', e.target.result);
$("#aaa").load(function() {
alert("Loaded");
});
};
reader.readAsDataURL(input.files[0]);
}
}
$(document).ready(function() {
$("#fileSelect").on("change", function() {
readURL(this);
})
});