Auto select search bar on submit

This commit is contained in:
Augusto Gunsch 2021-12-26 15:32:09 -03:00
parent 5a84789c7b
commit d30365ae01
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ $(document).ready(() => {
} }
}); });
$('#search-bar').on('focus', e => { searchBar.on('focus', e => {
setTimeout(() => e.currentTarget.select(), 100); setTimeout(() => e.currentTarget.select(), 100);
}); });
@ -45,8 +45,9 @@ $(document).ready(() => {
success: (data) => { success: (data) => {
$('#ajax-content').html(generateHtml(word, data)) $('#ajax-content').html(generateHtml(word, data))
searchBar.autocomplete('close');
window.scrollTo(0, 0); window.scrollTo(0, 0);
searchBar.select();
searchBar.autocomplete('close');
}, },
error: err => console.error(err) error: err => console.error(err)