Created
January 20, 2014 13:18
-
-
Save timbuethe/8519701 to your computer and use it in GitHub Desktop.
A Pen by Tim Büthe.
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 onsubmit="alert('form submitted'); return false;"> | |
<input type="submit" id="reset" value="Reset" onclick="console.log('reset clicked')"/> | |
<input type="submit" id="save" value="Save" onclick="console.log('save clicked')"/><br /> | |
<input type="text"/><br /> | |
<input type="password"/><br /> | |
<select name='options'> | |
<option value='option-1'>Option 1</option> | |
<option value='option-2'>Option 2</option> | |
<option value='option-3'>Option 3</option> | |
</select> <br /> | |
<textarea cols="30" rows="10"></textarea> | |
</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
$(function(){ | |
$('form').on('keypress', function(event){ | |
if(event.which === 13 && $(event.target).is(':input')){ | |
event.preventDefault(); | |
$('#save').trigger('click'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment