accountnujen,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.box {
background: black;
width: 50px;
height: 50px;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
const style = document.querySelector(".box").style;
document.querySelector("form").addEventListener("click", function({
target
}) {
let color = this.color.value;
if (target.closest(".allow")) style.backgroundColor = color;
if (target.closest(".send")) alert(color);
})
});
</script>
</head>
<body>
<form>
<select name="color" id="color">
<option value="blue">blue</option>
<option value="green">green</option>
</select>
<div class="box"></div>
<button type="button" class="allow">allow</button>
<button type="button" class="send">send</button>
</form>
</body>
</html>