Skip to content

Instantly share code, notes, and snippets.

@RyannosaurusRex
Created July 22, 2012 23:30
Show Gist options
  • Save RyannosaurusRex/3161385 to your computer and use it in GitHub Desktop.
Save RyannosaurusRex/3161385 to your computer and use it in GitHub Desktop.
Demonstrates JavaScript to click a send button on Enter keypress. Typical use case is a chat application where you want to auto-send when you hit Enter.
$("#textboxId").keyup(function (event) {
if (event.keyCode == 13) {
$("#sendId").click();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment