diff --git a/static/scripts/main.js b/static/scripts/main.js index 2db1ccd..b093ae2 100644 --- a/static/scripts/main.js +++ b/static/scripts/main.js @@ -41,6 +41,17 @@ async function loadCash(price) { } +async function indexOnLoad(){ + loadProducts(); + document.querySelector("input[autofocus]").addEventListener("blur", function() { + var t = this; + t.focus(); + setTimeout(function() { // Some browsers won't let you do it until + t.focus(); // after the blur has completed + }, 100); + }); +} + async function loadProducts() { const loadProductRequest = new Request(api_url + "/products") all_products = await makeAPIRequest(loadProductRequest) diff --git a/templates/index.jinja b/templates/index.jinja index 1723b69..dadca13 100644 --- a/templates/index.jinja +++ b/templates/index.jinja @@ -11,9 +11,9 @@ -
+