You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
By clicking “Sign up for GitHub”, you agree to our
terms of service
and
privacy statement
. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
According to the docs when I want to set a new value by jQuery I should just call
$('#selectid').val(value).trigger('change')
. This is not acceptable for me though because I use the change event to handle user interactions. However usually I don't want to trigger these when the value is set by javascript.
Is there a way to set the value without triggering the event? I would not mind triggering some custom event like
.trigger('select2:change')
or something.
Select2 only officially supports the
change
event for notifying the component when there is a change. This is pretty standard and we're avoiding implementing a custom event to get around this.
You
can
trigger the internal handler by just triggering
change.select2
, thanks to the way that jQuery namespaces events.
http://stackoverflow.com/q/17819709/359284#31856728
This is a duplicate of
#3620
.
In my opinion you should put this to documentation instead of or at least alongside with the normal change event.
Thanks!