user2016483
user2016483

Reputation: 593

jquery file-upload submit form on enter key press

first thanks a lot to people who made such a great tool as file-upload. I use file-upload (autoUpload:true) on a form with some other different input fields and because of file-upload, when I press "enter" key, nothing happen whereas I would like that this submit all my form.

is this possible ?

thanks

Upvotes: 1

Views: 1295

Answers (1)

Mathew Thompson
Mathew Thompson

Reputation: 56459

Try the keyUp event attached to the body. 13 is the key code for the enter key.

$("body").keyup(function (e) {
    var code = (e.keyCode ? e.keyCode : e.which)
    if(code == 13) {
        $("form").submit();
    }
});

If you want other key codes, see HERE

Upvotes: 4

Related Questions