I have the HTML:
<span class="btn btn-success js-uploader">
<i class="icon-upload icon-white"></i> Upload
<input type="file" multiple>
</span>
And the jQuery/JavaScript:
$('.js-uploader').click(function(){
$(this).find('input[type="file"]').click();
});
Basically, when a span with the class.js-upload is clicked, the file input should be clicked as well. But when I use .find() or .js-uploader > input[type="file"], it causes a RangeError.
console message:
too much recursionwhen you click on the input it also bubles to span, but span click-handler also causes click on input
try to check if the event.target is input