SO - 20243359
by Arun P Johny
HTML
<input type="file" id="myfile" style="display:none" />
<div class='some-class' id="add-image">
<h4> I want to open the file upload dilogue when anywhere of this div has been clicked</h4>
</div>
CSS
.some-class {
border: 1px solid grey;
}
h4 {
text-align:center;
}
JavaScript
jQuery(function ($) {
$("#add-image").click(function () {
$("#myfile").click();
});
})