[openstreetmap/openstreetmap-website] Add datalist to display multiple search results (PR #6765)

Marwin Hochfelsner notifications at github.com
Tue Feb 3 12:31:02 UTC 2026


@hlfan commented on this pull request.



>      endpoint.setValue(value);
   }
 
-  endpoint.setValue = function (value) {
+  function findDatalistOption(value) {
+    const options = datalist[0].querySelectorAll("option");
+    for (const option of options) {
+      if (option.value === value) {
+        return option;
+      }
+    }
+    return null;

Or if we're already using jquery:
```javascript
return datalist
  .find("option")
  .get()
  .find(option => option.value === value)
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6765#discussion_r2758837988
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6765/review/3744989145 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260203/a520f530/attachment.htm>


More information about the rails-dev mailing list