Update Select2 value, when "original" select control value changed

1,211 views
Skip to first unread message

penyo...@gmail.com

unread,
Jan 20, 2015, 3:49:35 AM1/20/15
to sel...@googlegroups.com
Hello,

Is there an option (any background thread/"watcher"), which will update select2 value, when "original" select control value change, but without calling .trigger("change") to original element?

Example:
I have a dropdown with id="gender", with attached select2 to it.
When I change from code gender's value (e.g. $("#gender").val("1"); ) without calling $("#gender").trigger("change"); I want to update select2 selected value.

I previewed the examples for version 3.5.2 and the only one which can help me is this: http://select2.github.io/select2/#event_ext_change
but there change event is triggered. I don't want to trigger "change" event...

Thanks!

cskar...@gmail.com

unread,
Jan 27, 2015, 6:58:51 AM1/27/15
to sel...@googlegroups.com, penyo...@gmail.com
Hello,
Did you find anything, to fix this?
If yes please let me know because I have the same issue.

Thanks in advance!

Kevin Brown

unread,
Jan 27, 2015, 4:15:41 PM1/27/15
to sel...@googlegroups.com
Hi,

Unfortunately this is not possible and likely won't be supported in the
future. Select2 needs the `change` event to know when the underlying
element has changed. The `change` event is pretty standard, and browser
controls usually emit it when the value has changed, which is why
Select2 uses it.

If you are running into situations where you need to both emit and catch
the `change` event, I would recommend looking into debouncing your
methods so they are only called when you want them to be.

--
Kevin Brown

https://kevinbrown.in
https://github.com/kevin-brown

Ali Shan Backlinks

unread,
Dec 20, 2025, 6:10:05 PM12/20/25
to select2

This is a common Select2 limitation, since it relies on the native change event to stay in sync with the original select element. Without triggering change, Select2 won’t automatically refresh its state, so understanding this behavior early can save debugging time and prevent unnecessary performance or GPU bottleneck issues in larger forms.

Electric Bikes Backlinks

unread,
Feb 8, 2026, 6:57:49 AMFeb 8
to select2
Great question! In Select2 3.5.2, the best way to update the displayed value without triggering a "change" event is to manually set the internal selection or use the val() method and then refresh the display, like $("#gender").select2("data", newData) or similar. However, since there isn't a built-in watcher that updates the UI silently, you might need to manually call the internal methods or update the selection object directly. Hope this helps in your Games!
On Tuesday, 20 January 2015 at 13:49:35 UTC+5 penyo...@gmail.com wrote:

Electric Bikes Backlinks

unread,
Feb 8, 2026, 6:58:45 AMFeb 8
to select2
I've faced a similar situation before. The key is to update the internal selection data without firing any event. In Select2 3.5.2, you can try directly setting the data property or using internal APIs like updateSelection() if accessible, but be cautious as these are not officially documented. The select2("data", ...) method can sometimes work silently. Just avoid triggering the "change" event explicitly. Good luck with your TECHBUNCH!
On Tuesday, 20 January 2015 at 13:49:35 UTC+5 penyo...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages