Skip to content

Instantly share code, notes, and snippets.

@joeegan
Created August 10, 2010 15:50
Show Gist options
  • Select an option

  • Save joeegan/517497 to your computer and use it in GitHub Desktop.

Select an option

Save joeegan/517497 to your computer and use it in GitHub Desktop.
Utilities.enterPress = function(config) {
$(config.trigger).keydown(function(ev){
// cross browser keyCode
var code = (event.keyCode ? event.keyCode : event.which);
if(code == 13) {
// default enterPress may submit an aspnetForm
ev.preventDefault();
config.func();
}
});
}
Utilities.enterPress({
trigger: '#login input#Password',
func: function(){
$('#Login').html('Logging in <span class="bg1"/><span class="bg2"/>').addClass('loading').click();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment