From 8673b658e0c12c2288ac2935a91184140c00fc66 Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Thu, 9 Jan 2025 15:50:00 +0100 Subject: Make a proper search form! --- search.html | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/search.html b/search.html index fe400ce..2768f1a 100644 --- a/search.html +++ b/search.html @@ -10,10 +10,12 @@ lang: "en" -

- - -

+
+

+ + +

+

Results for

@@ -45,10 +47,19 @@ lang: "en" } document.getElementById("qterm").textContent = queryterm; } - document.getElementById("qsubmit").onclick = function(ev) { - const qbox = document.getElementById("input_qterm").value; - if (qbox.length !== 0) { - query(qbox); - } + + // Function to be called on submit + function submitSearch() { + console.log("Search submitted"); + const qbox = document.getElementById("input_qterm").value; + if (qbox.length !== 0) { + query(qbox); + } + } + + // Attach event handler to form submission + document.getElementById("searchForm").onsubmit = function(ev) { + ev.preventDefault(); // Prevent default form submission behavior + submitSearch(); }; -- cgit v1.2.3