Choices-js / Choices

A vanilla JS customisable select box/text input plugin ⚡️
https://choices-js.github.io/Choices/
MIT License
6.06k stars 598 forks source link

set select's options by choices property. but how to add placeholder? #1111

Open zeroone2005 opened 1 year ago

zeroone2005 commented 1 year ago

`

const options = [{ value: item.id, label: item.name, customProperties: { content: item.content } }];

new d_type = new Choices({ searchEnabled: false, removeItems: true, removeItemButton: true, shouldSort : false, allowHTML: true, choices:options, });

`

ludekbenedik commented 8 months ago

Solution for version 10.2.0 (maybe earlier version too).

const options = [
    { value: '', label: 'Select value', placeholder: true },
    { value: 'a', label: 'A' },
    { value: 'b', label: 'B' },
];