dropdown options javascript code example

Example 1: javascript select element in dropdown

document.getElementById("stateSelect").selected = true;

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