dipson88 / treeselectjs

Treeselect on vanilla JS
MIT License
83 stars 15 forks source link

Possibility to add data-attributes #42

Closed bastien70 closed 1 year ago

bastien70 commented 2 years ago

Hey, is it possible to add to each option some data-attributes ? I think it could be a good feature

dipson88 commented 2 years ago

Hi @bastien70. Do you want to add attributes inside the options? (name: '1', value: '1', ...some attributes)? Do you want to set them as an HTML attribute or a result value on input?

bastien70 commented 2 years ago

Hello, the idea would be to be able to add them in HTML. Example :

In the js file :

name: 'name 1',
value: 'value 1',
attr: {'data-foo': 'foo', 'data-bar': 'bar'}

And the option rendered in HTML must therefore include these data attributes configured