Skip to content

Commit f2ae054

Browse files
senotrusovjpic
authored andcommitted
Docs, remove mention of private API: jQuery's data in <OPTION> elements
1 parent 3692766 commit f2ae054

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

docs/_includes/options/data/selection-access.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ <h2 id="selection-api-access">
1212
{% endhighlight %}
1313

1414
<p>
15-
As Select2 uses the HTML <code>&lt;SELECT&gt;</code> element to store the selection result, the selection data are represented by <code>&lt;OPTION&gt;</code> 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 <code>data()</code> method and accessible by key <code>'data'</code>:
15+
As Select2 uses the HTML <code>&lt;SELECT&gt;</code> element to store the selection result, the selection data are represented by <code>&lt;OPTION&gt;</code> elements and can be accessed in the plain jQuery/DOM manner:
1616
</p>
1717

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

2322
<p>
24-
Another technique is not to rely on jQuery's <code>data()</code> method but to extend the <code>&lt;OPTION&gt;</code> elements representing selection with the HTML data-* attributes containing arbitrary data from the source data objects:
23+
It is possible to extend the <code>&lt;OPTION&gt;</code> elements representing selection with the HTML data-* attributes containing arbitrary data from the source data objects:
2524
</p>
2625

2726
{% highlight js linenos %}

0 commit comments

Comments
 (0)