Last active
June 16, 2016 06:17
-
-
Save Ammly/1be4146a979bb9abe9ba21a592dbdf90 to your computer and use it in GitHub Desktop.
Press enter key to submit form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form> | |
<textarea></textarea> | |
<input type="submit" value="Submit"/> | |
</form> | |
<script> | |
$("textarea").keyup(function(event){ | |
if(event.keyCode == 13){ | |
$("form").submit(); | |
} | |
}); | |
$("form").on('submit', function(e){ | |
e.preventDefault(); | |
alert('dadada'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment