From: Anton Khorev Date: Tue, 4 Jun 2024 12:49:56 +0000 (+0300) Subject: Fix setting "From" in directions form based on search query X-Git-Tag: live~411^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/12281b1cc1c246cc1debcabbc12d2840cdb6666f Fix setting "From" in directions form based on search query --- diff --git a/app/assets/javascripts/index/search.js b/app/assets/javascripts/index/search.js index d41fc7d53..94bb52a1b 100644 --- a/app/assets/javascripts/index/search.js +++ b/app/assets/javascripts/index/search.js @@ -9,9 +9,9 @@ OSM.Search = function (map) { } }); - $(".search_form a.button.switch_link").on("click", function (e) { + $(".search_form a.btn.switch_link").on("click", function (e) { e.preventDefault(); - var query = $(e.target).parent().parent().find("input[name=query]").val(); + var query = $(this).closest("form").find("input[name=query]").val(); if (query) { OSM.router.route("/directions?from=" + encodeURIComponent(query) + OSM.formatHash(map)); } else {