Choices-js / Choices

A vanilla JS customisable select box/text input plugin ⚡️

Home Page:https://choices-js.github.io/Choices/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Placeholder not showing

zdimaz opened this issue · comments

new Choices(element, {
searchEnabled: true,
removeItemButton: true,
placeholder: true, // or text !
allowHTML: true,
itemSelectText: '', // Press to select
noChoicesText: 'No choices',
});
Select has attr
options

But rendered input not

select element does not have placeholder natively
You have two options :

  • Using input type="text" instead of select
  • Keep select and add new empty option to choices/items array

can't you use "placeholderValue" config option?

In my case, an option with this definition resolved:

{
    label: "Pick a item",
    placeholder: true,
    disabled: true,
    value: -1, // Or null
  }