partial update create page quick search

This commit is contained in:
arifal
2025-05-05 18:36:56 +07:00
parent d95676d477
commit 2618ac06d0
10 changed files with 663 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
document.addEventListener("DOMContentLoaded", function () {
const searchBtn = document.getElementById("searchBtn");
const searchInput = document.getElementById("searchInput");
searchBtn.addEventListener("click", function () {
const keyword = searchInput.value.trim();
if (keyword !== "") {
// Redirect to the route with query parameter
window.location.href = `/search-result?keyword=${encodeURIComponent(
keyword
)}`;
}
});
// Optional: trigger search on Enter key
searchInput.addEventListener("keydown", function (e) {
if (e.key === "Enter") {
searchBtn.click();
}
});
});