Re: Reloading the list data appends instead of replaces.

34 views
Skip to first unread message

Kevin Brown

unread,
May 9, 2016, 4:56:19 PM5/9/16
to select2
You can clear the existing options within a `<select>` by calling `.empty()` on the `<select>` jQuery element.

$('#my_select').empty();

That will remove any existing `<option>` elements, which sounds like what you are looking for.

On Mon, May 9, 2016 at 12:01 PM <garyst...@gmail.com> wrote:
I have a select2 list which I am trying to re-load via javascript, yet my efforts only result in APPENDING data to the list rather than replacing it. I feel like I am missing something.

How can I REPLACE the the data in a select2 list?

--
You received this message because you are subscribed to the Google Groups "select2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
To post to this group, send email to sel...@googlegroups.com.
Visit this group at https://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages