From 3be32e1a27849be2a645aad701847b95fb8ae3e4 Mon Sep 17 00:00:00 2001 From: Stefano Alberto Russo <stefano.russo@gmail.com> Date: Sun, 21 Feb 2021 00:19:59 +0100 Subject: [PATCH] Improved autofocus with pre-existent text. --- .../code/rosetta/core_app/templates/containers.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/webapp/code/rosetta/core_app/templates/containers.html b/services/webapp/code/rosetta/core_app/templates/containers.html index de5737a..badcfc4 100644 --- a/services/webapp/code/rosetta/core_app/templates/containers.html +++ b/services/webapp/code/rosetta/core_app/templates/containers.html @@ -81,7 +81,17 @@ {% include "footer.html" %} +<script> +$(document).ready(function() { + + var search_text_input = $("#search_text"); + var len = search_text_input.val().length; + search_text_input[0].focus(); + search_text_input[0].setSelectionRange(len, len); + +}); +</script> -- GitLab