From a925dd38ad8a51dbf443506b0772150a5cef0799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 15 Jul 2020 00:47:27 +0200 Subject: Repair jump to date. --- static/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'static/script.js') diff --git a/static/script.js b/static/script.js index 6870819b..822b60c2 100644 --- a/static/script.js +++ b/static/script.js @@ -493,8 +493,7 @@ window.onload = function () { form updates. */ - let jumpto = document.getElementsByClassName("jump-to")[0]; - let gotodatebtn = jumpto.getElementsByTagName("button")[0]; + let gotodatebtn = document.querySelector("#jump-to .btn"); let target_href = (new Date).format("%Y-%m-%d") + ".html"; let golink = makeElement('a', { className: 'btn', @@ -504,8 +503,9 @@ window.onload = function () { document.getElementById("today-button").href = target_href; gotodatebtn.replaceWith(golink); - jumpto.getElementsByTagName("input")[0].onchange = function () { + document.querySelector("#jump-to input[name='date']").onchange = function () { let date = this.valueAsDate.format("%Y-%m-%d"); + console.log(date); golink.href = date + ".html"; } -- cgit v1.2.3