I am struggling trying to get from my select2 multiple dropdown the html of selected options.
Here my case.
- I have this standard select2-multiple:
Now I change selection of users, but in console it is not able to take them using jQuery. The code to identify the selected options from dropdown is:
.select2-results__option[aria-selected=true]
So it should be found using this:
var selected_users = $('.select2-results__options').find('li .select2-results__option[aria-selected=true]').html();
$('.stakeholders_span').html(selected_users);
console.log(selected_users);
Console log gives always "undefined".
Anyone able to help me :)?
Thanks!