diff --git a/index.html b/index.html index 3db5b8f..513d527 100755 --- a/index.html +++ b/index.html @@ -49,7 +49,6 @@ $('button').corner('round 4px'); $('#box').corner('round bottom'); - $('#generate input').on('input', function() { var root = $('#root').val(); var master = $('#master').val() @@ -67,12 +66,26 @@ }); }); + var currentFocus; + var lastFocus; + $(':input').focus(function() { + currentFocus = this; + }); + $(document).keydown(function(e) { var keycode = e.keycode || e.which; if(keycode == 17) { + lastFocus = currentFocus; $('#password').focus().select(); } }); + + $(document).keyup(function(e) { + var keycode = e.keycode || e.which; + if(keycode == 17) { + lastFocus.focus(); + } + });