javascript change image onclick event with view uploaded image code example
Example 1: open the file upload dialogue box onclick the image
<input type="file" id="imgupload" style="display:none"/>
<button id="OpenImgUpload">Image Upload</button>
$('#OpenImgUpload').click(function(){ $('#imgupload').trigger('click'); });
Example 2: how to enable file input on click on image
<input type="file" id="imgupload">
<a href="#" onclick="$('#imgupload').trigger('click'); return false;">Upload file</a>