Sorry if you find this question repetitive, but I looked around, tried, failed, so need your help.
one.html
<html>
<head>
<link rel="stylesheet" href="one.css" >
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="one.js"></script>
</head>
<body>
<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>
</body>
</html>
one.css
.some-class{
border: 1px solid grey;
}
h4{
text-align:center;
}
one.js
$("#add-image").click(function(){
$("input[id='myfile']").click();
});
It shows sometimes
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
sometimes
uncaught rangeerror maximum call stack size exceeded
I don't know whats happening, if its a issue with the jquery version? Can you please help me? A working code sample or maybe a jsfiddle? Thank you in advance :)