summaryrefslogtreecommitdiffstats
path: root/web_src/js/features/autofocus-end.js
blob: da71ce9536d62785174b267f25a3ae102ddfd170 (plain)
1
2
3
4
5
6
export function initAutoFocusEnd() {
  for (const el of document.querySelectorAll('.js-autofocus-end')) {
    el.focus(); // expects only one such element on one page. If there are many, then the last one gets the focus.
    el.setSelectionRange(el.value.length, el.value.length);
  }
}