Return focus to visible boxes on ctrl release
This commit is contained in:
parent
ec017915c2
commit
d1478df484
1 changed files with 14 additions and 1 deletions
15
index.html
15
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();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue