html dropdown selected 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 select

<!-- O segundo valor estará selecionado inicialmente -->
<select name="select">
  <option value="valor1">Valor 1</option> 
  <option value="valor2" selected>Valor 2</option>
  <option value="valor3">Valor 3</option>
</select>

Example 3: select html

<select class="form-control">
  <option>1</option>
  <option>2</option>
  <option>3</option>
  <option>4</option>
  <option>5</option>
</select>

Example 4: html select list

<label for="cars">Choose a car:</label>

<select id="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

Example 5: options in html

<form id="form">
            <label for=""></label>
            <br>
            <input type="" id="">
            <br>
            <label for=""></label>
            <br>
            <input list="browsers" name="Thenicknamey" id="Thenickname">
            <datalist id="browsers">
                <option value=""></option>
                <option value=""></option>
                <option value=""></option>
            </datalist>
            <br>
            <label for=""></label>
            <br>
            <input type="" id="">
            <br>
            <input type="" id="">
        </form>