Created
March 30, 2016 21:17
-
-
Save shaik2many/7cf3c4f2826d0ab7baf5502e9adb2adf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://jsfiddle.net/LXp4h/ | |
<script> | |
select option { | |
color: black; | |
} | |
select option:first-child { | |
color: grey; | |
} | |
select.empty { | |
color: red; | |
} | |
/* Hidden placeholder */ | |
select option[disabled]:first-child { | |
display: none; | |
} | |
</script> | |
Re-selectable placeholder<br /> | |
<select> | |
<option value="" selected>Please select</option> | |
<option value="1">Item 1</option> | |
<option value="2">Item 2</option> | |
<option value="3">Item 3</option> | |
</select><br /> | |
Hidden placeholder<br /> | |
<select class="empty"> | |
<option value="" selected disabled>Please select</option> | |
<option value="1">Item 1</option> | |
<option value="2">Item 2</option> | |
<option value="3">Item 3</option> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment