Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
Safari only showing one option in select element

I'm creating a web site to add statistics from multiple games. The first part reads json files which contain the stats (multiple files per game) and populates an HTML select element for the user to select which games to include in the stats (allowing user to select multiple games). It's working in Chrome and Edge on my computers, but in Safari (iPhone) only one of the games shows as an option (the 4th of 5 games). Below is the function to read the files. Why would this not be working in Safari? I'm not sure if it has to do with the await / async or something else.

jsonFiles = ['file1.json', 'file2.json', 'file3.json'];

async function readGames() {
    let games = {};
    for (let file of jsonFiles) {
        let playlist;
        let gameDate;
        let response = await fetch(file);
        let data = await response.json();
        playlist = data.playlist;
        gameDate = (new Date(playlist.slice(playlist.indexOf('(')+1, playlist.indexOf(')'))).getTime())/10000;
        if (!(gameDate in games)) games[gameDate] = playlist;
    }
    //Remove previous options in the select element
    while(gamesSelect.firstChild) {
        gamesSelect.removeChild(gamesSelect.firstChild);
    }
    const gameValues = Object.values(games);
    for (let game of gameValues) {
        let option = document.createElement('option');
        option.setAttribute("value", game);
        option.innerHTML = game;
        gamesSelect.append(option);
    }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!