Something like this will works only when user clicks the anchor. But a form also is submitted when user push [enter] key inside the form. How could I have the same functionality using just an anchor?
$('a.submit').click(function() {
$(this).closest('form').submit();
});
Thanks.-
EDIT (with solution):
This combination works (at least) in FF and chrome! either clicking the anchor with class submit or pressing [enter].
$('#my_form a.submit').click(function(e) {
e.preventDefault();
$(this).closest('form').submit();
});
$('#my_form').keydown(function(e) {
if (e.keyCode != 13)
return;
$(this).submit();
});
Thanks for your comments!
After several test this is perfectly working: