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 is not visible

See original GitHub issue

Hello,

I have added the placeholder text to “ng-select” like it was mentioned in the docs,

<ng-select
       [options]="options"
       [multiple]="true"
       placeholder='My Placeholder'
       formControlName="control_name">
</ng-select>

However the placeholder does not show up initially, the select itself is working fine with the dropdown and all but the placeholder remains blank until I select some options from the dropdown and then remove them all at this point the placeholder text in the attribute shows up. Not sure what’s wrong…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vishnunair17commented, Jun 13, 2017

Well turns out the ng-select’s input element had an initial width of just 1px which is why the placeholder wasn’t visible, once an option was selected the width increased and hence it was visible later on. I couldn’t update the style/css of the input element using [ngStyle] I had to override the style block in my style.css to make it work,

ng-select > div > div.multiple input{
	width:100% !important;
	height:50px;
}
0reactions
omairaslam817commented, May 14, 2019

By setting <ng-select> property from [multiple]=“false” to [multiple]=“true” ,placeholder will be show at initially also,that works for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

input placeholder is not showing - Stack Overflow
add one more attribute placeholder="Hello". so when the page loads then placeholder will show. <input type="tel" name="natid" id="natid" ...
Read more >
Input placeholder not visible
Hi Gareth, You can change the visibility of the placeholder text, by adding this CSS to your app: The first input, has 'enabled'...
Read more >
Placeholder not appearing in textbox - HTML-CSS
I have no idea why this is happening. Placeholder shows up properly in the textbox of type “number” called Age. It seems to...
Read more >
placeholder-shown - CSS-Tricks
:placeholder-shown , being a pseudo-class, has to select an existing element. It selects the input whenever you're in the placeholder-showing ...
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