I'm using select2 on my select
tag, There is some additional when the user changes the selected option. and it makes use of attributes that I set as data-price
for instance. Select2 seems to be striping all attributes from the <option>
tags except for the value
.
How can I disable this behavior or how can I get the data values some other way?
Edit: I forgot to add that I'm also using Sonata admin. Sonata is the one loading select2 by default.
Turns out select2 was set to use remote data so my option
elements were being replaced. I set my data attributes in the AJAX callback function and now everything works.