events docs
This commit is contained in:
parent
ec6901d89f
commit
af5c13f515
@ -23,6 +23,8 @@ Select2 will trigger a few different events when different actions are taken usi
|
||||
|
||||
## Listening for events
|
||||
|
||||
All public events are relayed using the jQuery event system, and they are triggered on the `<select>` element that Select2 is attached to. You can attach to them using the [`.on` method](https://api.jquery.com/on/) provided by jQuery:
|
||||
|
||||
```
|
||||
$('select').on('select2:select', function (e) {
|
||||
// Do something
|
||||
@ -94,4 +96,6 @@ function log (name, evt) {
|
||||
|
||||
## Internal Select2 events
|
||||
|
||||
Select2 has an [internal event system](/advanced/default-adapters/selection#eventrelay) that works independently of the DOM event system. This internal event system is only accessible from plugins and adapters that are connected to Select2.
|
||||
Select2 has an [internal event system](/advanced/default-adapters/selection#eventrelay) that works independently of the DOM event system, allowing adapters to communicate with each other. This internal event system is only accessible from plugins and adapters that are connected to Select2 - **not** through the jQuery event system.
|
||||
|
||||
You can find more information on the public events triggered by individual adapters in the [advanced chapter](/advanced).
|
||||
|
@ -1,28 +0,0 @@
|
||||
|
||||
<h2 id="events-public">
|
||||
Public events
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
All public events are relayed using the jQuery event system, and they are
|
||||
triggered on the <code><select></code> element that Select2 is
|
||||
attached to. You can attach to them using the
|
||||
<a href="https://api.jquery.com/on/"><code>.on</code> method</a> provided
|
||||
by jQuery.
|
||||
</p>
|
||||
|
||||
<h2 id="events-internal">
|
||||
Internal events
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
Select2 triggers internal events using its own internal event system,
|
||||
which allows adapters to communicate with each other. These events are not
|
||||
accessible through the jQuery event system.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can find more information on the public events triggered by individual
|
||||
adapters in <a href="#adapters">the individual adapter documentation</a>.
|
||||
</p>
|
||||
</section>
|
Loading…
Reference in New Issue
Block a user