In my application I am using select2 plugin for drop-down with multiple select values. And now I want to add some static option to the select2 drop-down.
<select multiple="" class="test">
<option value="a">Illustrations</option>
<option value="b">Maps</option>
<option value="add">Add Status</option>
</select>
And I am applying multi select, now when I click on add status option I want to do some functionality and this option will not selected as like the option.
And my js code :
$('.test').select2();
$('.test').on("select2-selecting", function(e) {
alert($(".test").val());
});
But alert
is giving all the selected values a,b,add
. But I want to get the 'add'
option only.
Please suggest me how can I do this.
Thanks in advance.