Created by: fsateler
By using a data-value attribute, each item is forcefully converted into a string. If the items are not simple values, the resulting retrieval is useless at select time.
Storing it with the jQuery data function instead means the object is stored without problems.
This is the same as #6741 and #6847, rebased against the 3.0.0-wip branch