mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
loader.js: place focus at the end of text inputs
This commit is contained in:
parent
429405be0c
commit
d1fd7e4be7
@ -839,6 +839,15 @@
|
|||||||
|
|
||||||
if ($activeElement.length && $activeElement.is(':visible')) {
|
if ($activeElement.length && $activeElement.is(':visible')) {
|
||||||
$activeElement.focus();
|
$activeElement.focus();
|
||||||
|
if ($activeElement.is('input[type=text]')) {
|
||||||
|
if (typeof $activeElement[0].setSelectionRange === 'function') {
|
||||||
|
// Place focus after the last character. Could be extended to other
|
||||||
|
// input types, would require some \r\n "magic" to work around issues
|
||||||
|
// with some browsers
|
||||||
|
var len = $activeElement.val().length;
|
||||||
|
$activeElement[0].setSelectionRange(len, len);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (! autorefresh) {
|
} else if (! autorefresh) {
|
||||||
if (focusFallback) {
|
if (focusFallback) {
|
||||||
$(focusFallback.parent).find(focusFallback.child).focus();
|
$(focusFallback.parent).find(focusFallback.child).focus();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user