Auto select first value of a multiple dynamic dropdown

I figured this would be straight forward but nothing I try seems to work…

I have 3 simple dependent dynamic select menus (all set to multiple) and I want to automatically select the first value in each after the page loads.

The menus have the following IDs - level1_id, level2_id, ma_id

I’ve tried using the ‘Set Selected Index’ under Dynamic Events, setting this to zero on page load, e.g…

<body dmx-on:load="form1.level1_id.setSelectedIndex(0)">

But this doesn’t work.

I’ve also tried setting the selected index on the actual select elements themselves but the events all require some kind of interaction - click, hover etc.

I’ve also tried adding a bit of jquery but this has no effect either, e.g…

$('#level1_id').val($('#level1_id option').eq(0).val());

Does anyone know why this isn’t working?

Any help is very much appreciated.

Community Page
Last updated: