From 1d8b37add17e847d39745aeb8c59c983ab7a1066 Mon Sep 17 00:00:00 2001 From: Daoud Clarke Date: Thu, 16 Dec 2021 21:55:04 +0000 Subject: [PATCH] Set cursor at the end of the input --- static/index.html | 2 +- static/index.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 84d2ee61592aa917b7495bded6f67308dfe27672..354888dbe87980b07b0b47580fe2acee87b3c47f 100644 --- a/static/index.html +++ b/static/index.html @@ -11,7 +11,7 @@ Stoatally different.
- +
diff --git a/static/index.js b/static/index.js index 6d0426bf2238127b974c302140d0fbf34b7b6ea5..b5d6470ff2f56be302dc65f0aed80142b6abc1d5 100644 --- a/static/index.js +++ b/static/index.js @@ -3,6 +3,9 @@ window.onload = (event) => { const searchInput = document.getElementById('search'); + const length = searchInput.value.length; + searchInput.setSelectionRange(length, length); + searchInput.addEventListener('keyup', (e) => { console.log(searchInput.value);