1

I'm populating a select2 with options from an array and it almost works the way I want, but I'd like to add data-attributes to the actual option tags, in addition to just value and option text. How do I do it?

var categories =
[
    {
        id: 0,
        text:'Category',
        "data-type": 'global'
    }
];

$('select').select2({data:categories});
SeaBass
  • 1,322
  • 2
  • 15
  • 41

0 Answers0