Topic: Material select onchange doesn't fire again
The onchange event should fire every time I change the material-select.
If I chose an option in the material-select "oertlichkeit", it fills the material-select "ort" with some values. If I change the material-select "oertlichkeit" again, before I chose a value in material-select "ort", it fires the onchange event again and it works. But as soon as I chose a value in the material-select "ort", and then change the material-select "oertlichkeit" again, it doesn't fire the onchange event anymore.
Some versions ago, it worked normally. And it also works in an older bootstrap version. Where's the problem?
The whole code is in the snippet.
Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/jquery/custer/2204357
Hi No there is not really an error in the console about that:
It's strange that it works, as long as I do not chose any option in the second select-element.
If I chose an option in the second select element "ort", there is no activity anymore in the console, if I change the select "oertlichkeit".
As I could test now, the onchange event fires, even after changing de second select "ort". But the select "ort" does not get the new options, after chosing once an option.
I compared now the select and the html. And I noticed, that all the ajax stuff and the innerhtml replacement works. But the select does not refresh and show the new options. How can this be? What's the problem?
- I choosed an option in select1 "oertlichkeit".
- I choosed an option in select2 "ort".
- Then changed the option in select1 "oertlichkeit"
The result is: The html changes correctly, but the select does not show the new options. As it would not refresh.
Compared again an I found the problem in the html code:
The options are correctly changed. But there is still html-code that has not changed, above the option tags.
For example this:
- User: Pro
- Premium support: Yes
- Technology: jQuery
- MDB Version: 4.19.0
- Device: Computer
- Browser: Chromium Edge / Chrome
- OS: Windows 10 (1909)
- Provided sample code: No
- Provided link: Yes
- Keyboard tab navigation to search field of material select is not working. Upon receiving the focus to search textbox, dropdown disappears and leaving inaccessible for a keyboard user
- Double material select element (second one fetching content from DB) freezes website and browser tab