Skip to main content
added 117 characters in body
Source Link
Michael Haddad
  • 4.5k
  • 9
  • 48
  • 94

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select>

-- select an option -- Will be displayed by default. But if you choose an option, you will not be able to select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option, you will not be able to select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select>

-- select an option -- Will be displayed by default. But if you choose an option, you will not be able to select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

added 4 characters in body
Source Link
gam6itko
  • 16.1k
  • 2
  • 22
  • 18

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option,you you will not be able to select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option,you will not be able select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option, you will not be able to select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Added a second option that doesn't need CSS code. Suggested by the comments
Source Link

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option,you will not be able select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option,you will not be able select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Maybe this will be helpful

<select> <option disabled selected value> -- select an option -- </option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

-- select an option -- Will be displayed by default. But if you choose an option,you will not be able select it back.

You can also hide it using by adding an empty option

<option style="display:none">

so it won't show up in the list anymore.

Option 2

If you don't want to write CSS and expect the same behaviour of the solution above, just use:

<option hidden disabled selected value> -- select an option -- </option>

Rollback to Revision 6 - Edit approval overridden by post owner or moderator
Source Link
gam6itko
  • 16.1k
  • 2
  • 22
  • 18
Loading
Rollback to Revision 4
Source Link
j08691
  • 208.5k
  • 33
  • 269
  • 281
Loading
Valid html.
Source Link
John
  • 1
  • 16
  • 111
  • 196
Loading
based on comments
Source Link
gam6itko
  • 16.1k
  • 2
  • 22
  • 18
Loading
typo
Source Link
gam6itko
  • 16.1k
  • 2
  • 22
  • 18
Loading
typo fix
Source Link
gam6itko
  • 16.1k
  • 2
  • 22
  • 18
Loading
Source Link
gam6itko
  • 16.1k
  • 2
  • 22
  • 18
Loading