The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove a selected option from an aui-select2 using JS?

s
January 31, 2018

I am very new to the programming. I have an aiu-select2 box with multiple options as selected. At some point I need to deselect a particular option from the selection and need to replace it with new option using Java Script.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 1, 2018

Hi Sabin,

aui-select2 is based on Select2 version 3.x, so you can see the documentation for that here: http://select2.github.io/select2/

If you can't figure out how to remove one particular option, you may have to get all values into a list, remove the value you don't want, add the new one, and then set the value of the select2 with the new list of values.

s
February 7, 2018
1 vote
vijesh kumar
March 31, 2020

You can use  AJS.$("#resourcesDropdown").auiSelect2('val','');

Steffen Stamprath
July 25, 2022

Workaround works fine! thanks

Steffen Stamprath
July 25, 2022

ahhhhhhhh! Now I found the correct solution on http://select2.github.io/select2/

:D

When placeholder is used for a non-multi-value select box, it requires that you include an empty <option></option> tag as your first option.

TAGS
AUG Leaders

Atlassian Community Events