Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Set cursor at the end of the input

Daoud Clarke1d8b37add17e
diff --git a/static/index.html b/static/index.html
index 84d2ee6..354888d 100644
--- a/static/index.html
+++ b/static/index.html
@@ -11,7 +11,7 @@
Stoatally different.
<form action="/search">
- <input type="search" id="search" name="s" />
+ <input type="search" id="search" name="s" value="" autofocus/>
</form>
<div id="results">
diff --git a/static/index.js b/static/index.js
index 6d0426b..b5d6470 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);