Hi
I am trying to populate a dropdown with data coming from an API. Is it possible to populate it so that the text is different to the value?
So achieve something like this:
<option value="some-id">Friendly text</option>
Currently I just end up with the value, not the text.
I’m starting with code something like this:
const response = await fetch('https://some.api/schools');
const schoolData = await response.json();
const schools = schoolData.map( s => {
let o = {};
o.value = s["Email"];
o.title = s["Name"];
return o;
}).sort();
MyDropdown.options = schools;
Thanks
Tim