1
0
mirror of synced 2025-02-04 06:09:23 +03:00

Add event handler example to documentation on how to programmatically access a selection data.

This commit is contained in:
Stan Senotrusov 2016-05-02 15:26:43 +02:00 committed by James Pic
parent 576f93778d
commit bae34d4f8a

View File

@ -35,6 +35,16 @@ $('select').select2({
// Retrieve custom attribute value of the first selected element
$('select').find(':selected').attr('data-custom-attribute')
{% endhighlight %}
<p>
In addition, properties/values from source data objects can ba accessed from within event handler:
</p>
{% highlight js linenos %}
$('select').on('select2:select', function (event) {
console.log(event.params.data)
});
{% endhighlight %}
</section>