vincent vincent - 1 year ago 68
Javascript Question

triggering a file input button

I have the following situation:

<input id="upload_trigger_btn" type="file" name="files[]" multiple>
<a type="submit" class="button-normal-12px-ffffff" href="#"><span>Add files</span></a>

$(".add_files_btn").bind("click", function () {

So basically i want to trigger the file input button using another. This works great in firefox and IE but the button doesn't get triggered in chrome and safari.

Answer Source

I think you could get away with:

$(".add_files_btn").unbind("click").bind("click", function () {