From d30365ae0175c134682d8f9006e24e981470edc7 Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Sun, 26 Dec 2021 15:32:09 -0300 Subject: [PATCH] Auto select search bar on submit --- static/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/index.js b/static/index.js index 982b9ab..468172d 100644 --- a/static/index.js +++ b/static/index.js @@ -26,7 +26,7 @@ $(document).ready(() => { } }); - $('#search-bar').on('focus', e => { + searchBar.on('focus', e => { setTimeout(() => e.currentTarget.select(), 100); }); @@ -45,8 +45,9 @@ $(document).ready(() => { success: (data) => { $('#ajax-content').html(generateHtml(word, data)) - searchBar.autocomplete('close'); window.scrollTo(0, 0); + searchBar.select(); + searchBar.autocomplete('close'); }, error: err => console.error(err)