default selected select htm; code example

Example 1: html select default

<select>
  <option value="" selected disabled hidden>Choose here</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
  <option value="4">Four</option>
  <option value="5">Five</option>
</select>

Example 2: html form reject default drop down list

//To force form validation on a select input:
//you need to use the required attribute on your select form and
//set the value of the initial option to "".
//Notice that you have to set the value -""- as invalid
<form>
  <select id="cars" name="cars" required aria-invalid="">//Required tag + "" is considered invalid
	<option value="" selected disabled hidden>Choose car...</option> //Default option
	  <option value="volvo">Volvo XC90</option>
	  <option value="saab">Saab 95</option>
	  <option value="mercedes">Mercedes SLK</option>
	  <option value="audi">Audi TT</option>
</select>
  <button type="submit">Submit</button>
</form>

Tags:

Html Example