0

I have Data from an Ajax Drop Down list that I can't adjust. However, I only want to display dropdown elements that have a certain string part in its name ("Delivery").

I can't adjust the Ajax list directly so how can I manipulate the visibility on certain elements?

So this is part of the code that is currently used on the dropdown:

a.dropCityChanged = function() {
    a.dropCities && (a.loading.dropLocations = !0, e.getAjax({
        country: a.form.dropCountry.id,
        city: a.form.dropCity.id
    }).then(function(b) {
        a.loading.dropLocations = null, a.dropLocations = b, 1 === b.length && (a.form.dropLocation = b[0])
    }))
}

But I only want to show the dropLocations that have a certain string in its name

I tried a few things like (name~= "Delivery") and var.includes("Delivery") but none worked so far.

Added a screenshot from the dropdown, maybe makes it more clear, I only want the entries with "Hotel Delivery displayed: dropdown-example

Help is much appreciated.

Thanks.

Carina
  • 1
  • 3
  • 1
    Possible duplicate of [Access iframe elements in JavaScript](https://stackoverflow.com/questions/1451208/access-iframe-elements-in-javascript) – GrafiCode Oct 15 '19 at 09:24
  • If you could share Code Snippet then it would be beneficial to solve your issue. – Kalyani Rathore Oct 15 '19 at 13:07
  • Or at least some input data in the format you try to use, and the expected value :) – muka.gergely Oct 15 '19 at 13:54
  • @KalyaniRathore added code snippet in my question, also here one function I tried: `function(b) { a.locations = b; var c = d("filter")(a.locations, { name: f.location && f.includes("Delivery") }, !0); ` But I am unsure if and where I can add .includes correctly as I haven't worked with it before – Carina Oct 15 '19 at 15:14

0 Answers0