Created
January 20, 2013 06:02
-
-
Save ifnull/4576905 to your computer and use it in GitHub Desktop.
Make the enter key work with Drupal login
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
Drupal.behaviors.loginAJAXSubmit = { | |
attach: function (context, settings) { | |
var ajax = Drupal.ajax[$('#tab-login .form-submit').attr('id')]; | |
if(typeof ajax != 'undefined'){ | |
$('input',ajax.element_settings.element.parentElement.parentElement).bind("keypress", function (e) { | |
var code = (e.keyCode ? e.keyCode : e.which); | |
if(code == 13) { //Enter keycode | |
$(ajax.element_settings.element).trigger(ajax.element_settings.event); | |
} | |
}); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment