Is there a jquery event for when options are added or removed from a select control on an HTML page? I have tried .change()
but it only seems to fire when I click on option elements. I.e. this doesn't work:
$(function() {
$('#select').change(function() {
alert('hello world');
})
});
Thank you :).
When adding a new element to an existing dropdown, you should do a: $("#selector").trigger ("change"); to get the behaviour you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With