@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/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to