Is there a way for the jQuery plugin select2 to retain the class of each select option?
<p>I'm using the jQuery plugin <a href="https://select2.github.io/" rel="nofollow">select2</a> and I'm wondering if there was any way that you could make it retain (merge) a class you have set on each <code>option</code> element in the inital <code>select</code> field and insert it as an additional class in the resulting <code>li</code> tag?</p>

<p>So currently they get a class of <code>select2-results__option</code>; what I want would be something like: <code>select2-results__option myclass</code>.</p>

<p>Can this be done?</p>

<p>Also, it doesn't <em>have</em> to be a class, even retaining a <code>data</code> attribute would work too.</p>