I have the following:
$(document).ready(function(){
var span = $('#multiple_group_select_chosen span:first');
span.on('DOMSubtreeModified', function(){
console.log('bla');
if (['No groups in this year', '', 'Now please select a group', 'Please select a'].includes(span.text())) {
$('#classes').disabled = true;
} else {
$('#classes').disabled = false;
}
});
});
When I call
$('#multiple_group_select_chosen span:first').text()
from the console it returns the value selected from the dropdown, and this changes as the dropdown selection changes. How can I detect when this happens? At the moment there is no console.log of 'bla' occuring...
Thanks in advance.
EDIT: HTML
<div class="chosen-container chosen-container-single chosen-container-single-nosearch" style="width: 100%;" title="" id="multiple_group_select_chosen">
<a class="chosen-single">
<span>DROPDOWN TEXT</span>
<div><b></b></div>
</a>
</div>
I don't have much control over how this html is coming out