I've been trying to attach a data-*
attribute in a Semantic UI dropdown option
but to no success (the data attributes are not being copied to the resulting dropdown options).
Here's the structure of my select
:
HTML
<select id='my-dropdown' name='department'>
<option value='1' data-wsg='something'>Department 1</option>
<option value='2' data-wsg='another'>Department 2</option>
. . .
<option value='n' data-wsg='custom data'>Department N</option>
</select>
jQuery
$("#my-dropdown").dropdown({
allowAdditions: false,
fullTextSearch: true,
onHide: function() {
// Some codes.
},
onChange: function(value, text, choice) {
// Access the data-wsg attribute of the selected option.
}
});
I've been reading around a bit but all I saw regarding data attribute support was storing the settings in there. Not really what I need.
Hopefully someone has done something similar and let me know what the solution is.