I have a input tag of type "File" in my phonegap mobile application. I am selecting only images from that tag. Now my issue was How can we display the selected image in the same HTML, If user select the image the image should display in the HTML. Is it possible?
<input type="file" id="fileUploader" />
<img id="preview" src="#" alt="your image" />
javascript:
function readIMG(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#preview').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#fileUploader").change(function(){
readIMG(this);
});
The selected image should display in the "selectedImage" Div. Is it possible? Any suggestions please