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');
|
$('button').corner('round 4px');
|
||||||
$('#box').corner('round bottom');
|
$('#box').corner('round bottom');
|
||||||
|
|
||||||
|
|
||||||
$('#generate input').on('input', function() {
|
$('#generate input').on('input', function() {
|
||||||
var root = $('#root').val();
|
var root = $('#root').val();
|
||||||
var master = $('#master').val()
|
var master = $('#master').val()
|
||||||
|
@ -67,12 +66,26 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var currentFocus;
|
||||||
|
var lastFocus;
|
||||||
|
$(':input').focus(function() {
|
||||||
|
currentFocus = this;
|
||||||
|
});
|
||||||
|
|
||||||
$(document).keydown(function(e) {
|
$(document).keydown(function(e) {
|
||||||
var keycode = e.keycode || e.which;
|
var keycode = e.keycode || e.which;
|
||||||
if(keycode == 17) {
|
if(keycode == 17) {
|
||||||
|
lastFocus = currentFocus;
|
||||||
$('#password').focus().select();
|
$('#password').focus().select();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).keyup(function(e) {
|
||||||
|
var keycode = e.keycode || e.which;
|
||||||
|
if(keycode == 17) {
|
||||||
|
lastFocus.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue