my image preview working fine before upload but i need a textarea also for writing about image but when image preview show then textarea also show with image .. when image not available then textarea hide..
this is my code
echo "<label for=\"file-input\"><i class=\"fas fa-upload fa-3x\" style=\"color: #ccc;\"></i></label>";
echo "<input type=\"file\" class=\"image-upload\" id=\"file-input\" name=\"my_field\" onchange=\"readURL(this);\" accept=\"image/*\" required>";
echo "<img id=\"blah\">";
<script type="text/javascript">
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah')
.attr('src', e.target.result)
.width(100)
.height(100);
};
reader.readAsDataURL(input.files[0]);
}
}
</script>