Ionic 5 ion-select change event not working

I’m using Ionic 5 core with vanillaJS and ion-select is not dispatching change event.

<ion-item>
    <ion-select value="-1" interface="popover" onchange="test()">
      <ion-select-option value="-1">All</ion-select-option>
      <ion-select-option value="a">A</ion-select-option>
      <ion-select-option value="b">B</ion-select-option>
      <ion-select-option value="c">C</ion-select-option>
    </ion-select>
</ion-item>



test()
{
     console.log("test");
}

As I’m not familiar with usage of Ionic components without a framework, can you point me towards somewhere in the Ionic documentation that suggested that onchange was expected to do anything? I can’t find anything that refers to anything outside of ionChange in the test suite.

1 Like

Yes, you are right, onchange is not mentioned in the doc but others controls like button, input, searchBar all are working on events like onclick and oninput as per doc. So, i assumed that ion-select may follow the same approach but it didn’t.

You even dont need JS to attach event to them, you can just right them in their html right away but not ion-select.
Same thing is happening in your given link.

i think, you answered without even seeing my post. i need it for JS not Angular

I am sorry, i believe ionChange=“methodName($event)” should do it try that without the ().

Debes poner (ionChange) en lugar de onchange