Last active
          November 23, 2015 16:51 
        
      - 
      
- 
        Save erkobridee/608da57895541b5c39d4 to your computer and use it in GitHub Desktop. 
    prevent form submit on enter key press
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | <!-- useful when working with angular --> | |
| <form | |
| name="nameForm" novalidate | |
| onkeydown="return !((event.keyCode===13) && (event.target.type==='text'))"> | |
| <!-- prevent form submit on enter --> | |
| <input type="text" name="name"> | |
| <textarea name="description"></textarea> | |
| <!-- other fields --> | |
| </form> | |
| <!-- | |
| How to disable the Enter key on HTML form | |
| http://webcheatsheet.com/javascript/disable_enter_key.php | |
| --> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment