diff --git a/docs/_includes/options/data/selection-access.html b/docs/_includes/options/data/selection-access.html index 7c8d01c2..a1559117 100644 --- a/docs/_includes/options/data/selection-access.html +++ b/docs/_includes/options/data/selection-access.html @@ -12,16 +12,15 @@ $('select').select2('data'); {% endhighlight %}

- As Select2 uses the HTML <SELECT> element to store the selection result, the selection data are represented by <OPTION> elements and can be accessed in the plain jQuery/DOM manner. The resulting elements will have properties/values from the source data objects, stored by the means of jQuery data() method and accessible by key 'data': + As Select2 uses the HTML <SELECT> element to store the selection result, the selection data are represented by <OPTION> elements and can be accessed in the plain jQuery/DOM manner:

{% highlight js linenos %} -// Retrieve source data object's data of the first selected element -$('select').find(':selected').data('data'); +$('select').find(':selected'); {% endhighlight %}

- Another technique is not to rely on jQuery's data() method but to extend the <OPTION> elements representing selection with the HTML data-* attributes containing arbitrary data from the source data objects: + It is possible to extend the <OPTION> elements representing selection with the HTML data-* attributes containing arbitrary data from the source data objects:

{% highlight js linenos %}