Submit the closest form
$("element").closest("form").submit();
You need to add an event keydownand send the nearest form:
$("input[type=text]")
.keydown(function(e) {
if (e.keyCode == 13)
$(this).closest("form").submit();
});
See closest in jQuery docs
source
share