JSFiddle - React, Tailwind, and code Playground

by alnitak

HTML

<form>
    <select id="s">
        <option id="o1">option 1</option>
        <option id="o2" selected="selected">option 2</option>
    </select>
</form>

JavaScript

var s = document.getElementById('s');
var o1 = document.getElementById('o1');
var o2 = document.getElementById('o2');

o1.selected = true;

// or s.value = 'option 1';