I am doing a similar thing, however I am hiding the select2 container, which is always the next node from the starting point so that it looks.
$(document).on('change', '.country', function () {
if ($(this).val() == $(this).data('current-countryCode')) {
$('#states').next(".select2-container").show();
}
else {
$('#states').next(".select2-container").hide();
}
});
So, I take the same approach that you have
source
share