<form class="uk-form-stacked">
<label class="uk-form-label" for="kUI_dropdown_basic_select">Select a user</label>
<select id="kUI_dropdown_basic_select" class="uk-form-width-medium" onchange="getIPL();">
<?php foreach ($response->result->allAcc as $data) { ?>
<option value="<?php echo $data->Id;?>"> <?php echo $data->Name; ?></option>
<?php } ?>
</select>
</form>
<script>
function getIPL() {
var urlmenu = document.getElementById( 'kUI_dropdown_basic_select' );
urlmenu.onchange = function() {
window.open( 'admin_mailbox.php?Id=' + this.options[ this.selectedIndex ].value,"_self");
};
}
</script>
Thank you for taking the time for reading my question.
onchange() is not working for the first time
second time it works fine
changeevent just uses multiple handlers at different times. – The first occurrence ofchangeinvokesgetIPL(), which just replaces itself as the handler with a different function. That 2nd function then opens new windows on each subsequent occurrence of the event.