JSFiddle - React, Tailwind, and code Playground
HTML
<form onsubmit="allow(event)">
<select name="color" id="color">
<option value="blue">blue</option>
<option value="green">green</option>
</select>
<div class="box"></div>
<button>allow</button>
<button>send</button>
</form>
CSS
.box {
background:black;
width:50px;height:50px;
}
JavaScript
function send(event) {
event.preventDefault ? event.preventDefault() : event.returnValue = false;
alert(event.target[0].value);
}
function allow(event) {
event.preventDefault ? event.preventDefault() : event.returnValue = false;
document.querySelector(".box").style.backgroundColor = event.target[0].value;
}