diff --git a/static/scripts/main.js b/static/scripts/main.js index b093ae2..8fe8ca9 100644 --- a/static/scripts/main.js +++ b/static/scripts/main.js @@ -42,6 +42,7 @@ async function loadCash(price) { } async function indexOnLoad(){ + document.body.addEventListener('click', focusBarcodeInput, true); loadProducts(); document.querySelector("input[autofocus]").addEventListener("blur", function() { var t = this; @@ -52,6 +53,10 @@ async function indexOnLoad(){ }); } +function focusBarcodeInput(){ + document.getElementById('barcode_input').focus() +} + 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 dadca13..651c7b4 100644 --- a/templates/index.jinja +++ b/templates/index.jinja @@ -11,7 +11,7 @@ - +