SO - 20243359

by Arun P Johny

HTML

<div class='some-class' id="add-image">
    <input type="file" id="myfile" style="display:none" />
     <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();
    });
})