DEV Community

Discussion on: Listen the dynamic HTML select field changes with MutationObserver API

Collapse
 
grossconstantin profile image
Constantin Groß

Note that this only works when using setAttribute() and removeAttribute() on the option elements, instead of option.selected = true/false, because the MutationObserver will only pick up changes in the serialized DOM. So if the script for the custom select uses the latter and doesn't trigger a change event, you're out of luck, unfortunately.