Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholder color #1139

Closed
RALGIE opened this issue Aug 31, 2015 · 6 comments
Closed

Placeholder color #1139

RALGIE opened this issue Aug 31, 2015 · 6 comments

Comments

@RALGIE
Copy link

RALGIE commented Aug 31, 2015

Hello,

When I set the title from the select and add an empty element the combobox displays the placeholder(tittle). This is desirable. But the color from the placeholder is not the wright color. It should be the color that is defined in bootstrap/css file.
Is there a solution to this problem or is this a bug?

@brunocascio
Copy link

+1

@myplacedk
Copy link

I don't see a way to do that without modifying bootstrap.

But by adding a class to the button, users can choose to style bootstrap-select the same way they style other form elements.

myplacedk pushed a commit to myplacedk/bootstrap-select that referenced this issue Oct 30, 2015
myplacedk added a commit to myplacedk/bootstrap-select that referenced this issue Oct 30, 2015
@ARS81
Copy link

ARS81 commented Jan 22, 2016

+1 with some addition:

If an option is already selected (select has value), but then the user later selects an option with no value (tipically the first, blank option), than the select should be showing again the placeholder text with it's custom placeholder color (instead of showing empty text like it does now).

<select class="selectpicker" title="Choose a city">
  <option></option> {* show the placeholder title when this is selected *}
  <option value="1">Budapest</option>
  <option value="2">London</option>
  <option value="3">Paris</option>
</select>

@bqst
Copy link

bqst commented Jan 24, 2016

+1

@msct
Copy link

msct commented Feb 17, 2016

In the past I've got this feature with a one-liner in the render function.

//Toggle the placeholder class, depending whether we have a valid title yet
this.$button.toggleClass('placeholder', (title === ''));

It was placed right above if (!title) {

Default Bootstrap placeholder is color is #999, so CSS would be something like:
.bootstrap-select .btn-default.placeholder {color:#999}
.bootstrap-select .btn-default:hover.placeholder,
.bootstrap-select .btn-default:active.placeholder {color:#777}

No Pull request because it has a small bug on initial page load when one uses the title attribute on the parent element. I don't use title, I've always use data-none-selected-text

@msct
Copy link

msct commented Feb 18, 2016

I love it! @caseyjhol

avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants