question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Placeholder not displayed for empty dropdown

See original GitHub issue

I use choices in single-select mode and set placeholder: true, placeholderValue: 'a string'. The placeholder is not displayed in UI if there are no choices. When I add choices later, the placeholder is displayed correctly. This happens with version 7.0.0

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

6reactions
Colin-Morancommented, Apr 8, 2019

I came across this problem since choices.ClearStore() also removes the placeholder item. The solution I’m using is this:

placeholderItem = choices._getTemplate( 'placeholder', 'This is a placeholder' ); choices.itemList.append(placeholderItem);

Where ‘choices’ is the name of your choices object.

0reactions
vitobottacommented, Feb 25, 2020

Hi @jshjohnson I am having this issue now. I am fetching items with async ajax and one of the elements returned has the property selected set to true. Is there a fix or workaround for this? Thanks!

@hg64 @Colin-Moran @code-chris pinging you guys too in case you have found a proper solution for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Placeholder not displayed for empty dropdown #567 - GitHub
I use choices in single-select mode and set placeholder: true, placeholderValue: 'a string' . The placeholder is not displayed in UI if ...
Read more >
How do I make a placeholder for a 'select' box? - Stack Overflow
It shows the next one by default, in this case "Durr". Once the user has selected a value, he can not deselect again...
Read more >
How to Make a Placeholder for a Select Box in HTML
Answer: Use the disabled and selected Attribute. There is no attribute like input's placeholder for select box dropdown. However, you can create similar...
Read more >
Dropdown box not showing blank placeholder by default
It's a required field and by default it's set to have a blank placeholder and blank default value, however when you go to...
Read more >
:placeholder-shown - CSS: Cascading Style Sheets | MDN
The :placeholder-shown CSS pseudo-class represents any <input> or <textarea> element that is currently displaying placeholder text.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found