diff options
-rw-r--r-- | settings/js/personal.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index 591eb8abe2e..aa55832469c 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -165,6 +165,11 @@ $(document).ready(function(){ $('#email').keyup(function(){ if ($('#email').val() !== '' ){ + // if this is the enter key changeEmailAddress() is already invoked + // so it doesn't need to be triggered again + if(event.keyCode === 13) { + return; + } if(typeof timeout !== 'undefined'){ clearTimeout(timeout); } @@ -172,6 +177,18 @@ $(document).ready(function(){ } }); + $('#email').keypress(function(event){ + // check for enter key and non empty email + if (event.keyCode === 13 && $('#email').val() !== '' ){ + event.preventDefault() + // clear timeout of previous keyup event - prevents duplicate changeEmailAddress call + if(typeof timeout !== 'undefined'){ + clearTimeout(timeout); + } + changeEmailAddress(); + } + }); + $("#languageinput").change( function(){ // Serialize the data var post = $( "#languageinput" ).serialize(); |