JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<select>
<optgroup label="Some">
<option id="opt1">1</option>
<option id="opt2">2</option>
</optgroup>
</select>
<input type="text" id="inputTest1" />
</body>
JavaScript
$(document).ready(function () {
var showArea = $("#inputTest1");
$('select').on('change', function () {
// If you need the element that was selected
console.log($(this).find('option:selected:first').text());
// If you just need the value
console.log($(this).val());
});
});