Get classes on original option to select2 dropdown
<p>I have the following code for a select2 dropdown. My aim is to get all the attributes from the</p>

<p><code>&lt;option  level="2" data-type="ci_type" value="44"&gt;Sales Service&lt;/option&gt;</code> ,</p>

<p>on the select2 dropdown list which looks like this now</p>

<p><code>&lt;li class="select2-results-dept-0 select2-result select2-result-selectable"&gt;&lt;div class="select2-result-label"&gt;&lt;span class="select2-match"&gt;&lt;/span&gt; Sales Service&lt;/div&gt;&lt;/li&gt;</code></p>

<p>Is this possible?
During my research i found <code>formatResultCssClass</code> option , but not sure how to use this.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {

  $("#my_select2_dropdown").select2({

  })
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js"&gt;&lt;/script&gt;
&lt;link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.css" rel="stylesheet" /&gt;

&lt;label&gt;Value:&lt;/label&gt;
&lt;select id="my_select2_dropdown"  style=""&gt;
  &lt;option style="padding-left:0em" level="0" data-type="type" value="1"&gt;value1&lt;/option&gt;
  &lt;option style="padding-left:1em" level="1" data-type="type" value="2"&gt;value2&lt;/option&gt;
  &lt;option style="padding-left:2em" level="2" data-type="type" value="4"&gt;value3&lt;/option&gt;
  &lt;option style="padding-left:2em" level="2" data-type="type" value="5"&gt;value4&lt;/option&gt;
  &lt;option style="padding-left:1em" level="1" data-type="type" value="7"&gt;value5
&lt;/select&gt;</code></pre>
</div>
</div>
</p>