Dropdown doesn't change with expression onChange

Hi,
I recently finished coding a form for my website, but can’t solve this problem:
In the form there is a dropdown field where the user can choose in which Swedish county they are located (#plats). When the user has chosen county, I want the following dropdown (#kommuner) to show the municipalities in the county, which the user also can choose from:


I created a public javascript file with all the municipalities in each county(these are just 2 of them, there are 23):


And imported them to the site code:


Lastly, I wrote the site code (this is just a part of it):

$w('#plats').onChange(() => {
            $w('#kommuner').enable();
            if ($w('#plats').value === 'Norrbotten') {
                $w('#kommuner').options = norrbottenkommuner;
                $w('#kommuner').placeholder = 'Välj Kommun';
                $w('#kommuner').enable();
            } else if ($w('#plats').value === 'Västerbotten') {
                $w('#kommuner').options = västerbottenkommuner;
                $w('#kommuner').placeholder = 'Välj Kommun';
                $w('#kommuner').enable();
            } else if ($w('#plats').value === 'Jämtland') {
                $w('#kommuner').options = jämtlandkommuner;
                $w('#kommuner').placeholder = 'Välj Kommun';
                $w('#kommuner').enable();
            } else if ($w('#plats').value === 'Västernorrland') {
                $w('#kommuner').options = västernorrlandkommuner;
                $w('#kommuner').placeholder = 'Välj Kommun';
                $w('#kommuner').enable();
            } else {
                $w('#kommuner').value = '';
                $w('#kommuner').disable();
                $w('#kommuner').expand();
            }
        });

What am I doing wrong? The municipality field doesn’t do anything, just stays disabled even after chosen county. Here is my website: www.atersalj.se/annonsera

Hej där Sverige!
I think that using the Swedish characters ÅÄÖ in code is not going to work and is not recommended at all. So first of all try renaming all arrays and make sure that åäö is not present in any of the names. I would imagine that you get some error in the developer console when running the page? Look there and paste in the errors here så ska jag hjälpa dig :slight_smile:

Hej Andreas!
I actually didn’t get any errors in the developer console, but I changed all the ÅÄÖ to AAO instead, and also moved the code closer to the onReady (function). That solved the issue.
Tackar för hjälpen :slight_smile:

@karlsellergren Inga problem! Please mark my answer if it solved your issue as Top Comment as it helps me in the forum. Lycka till!