0

I am working on a HTML code which has Select tag used in it. I am trying to add below given code to get the placeholder text for Select list but somehow in the generated HTML on web page I see that value="" gets replaced by value="Select"

<select id="call_quality_issue_type" required="true">
    <option value="">Select</option>
</select>

As a result I am not able to use the .invalid property on select in the css to get the placeholder behavior working

Yogesh D
  • 1,663
  • 2
  • 23
  • 38
  • Your question is unclear. What doe you mean by "to get the placeholder text for Select list"? How is the page generated? Also, your closing select tag should be all lowercase – j08691 Nov 17 '17 at 18:03
  • @j08691 yes select is all lowercase. I want to have a placeholder select list value which should grayed out but all other values should be black. I referred https://stackoverflow.com/questions/5805059/how-do-i-make-a-placeholder-for-a-select-box this post here – Yogesh D Nov 17 '17 at 18:09

1 Answers1

0

if you are looking for a placeholder, you may want use disabled on the option tag :

<select id="call_quality_issue_type" required="true">
    <option disabled selected value> -- select an option -- </option>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
</select>
Florient
  • 236
  • 1
  • 9
  • I can put disabled and selected properties in there but the issue that I am facing is whenever I do value="" it gets replaced in the generated HTML as value="Select" which is not helping me in using the _select:invalid_ in css – Yogesh D Nov 17 '17 at 18:30