default dropdown input html code example

Example: 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