You cannot do this without JavaScript. Stackoverflow uses the jQuery JavaScript library, which binds functions to HTML elements when the page loads.
Here you can do it using basic JavaScript:
<textarea onkeydown="if (event.keyCode == 13) { this.form.submit(); return false; }"></textarea>
The key code is the enter key.
Here's how you could do it with jQuery, as Stackoverflow does:
<textarea class="commentarea"></textarea>
from
$(document).ready(function() { $('.commentarea').keydown(function(event) { if (event.keyCode == 13) { this.form.submit(); return false; } }); });
BalusC Dec 11 '10 at 20:47 2010-12-11 20:47
source share