JSFiddle - React, Tailwind, and code Playground
by neysor
HTML
<select name="selection" class="box1">
<option>0</option>
<option selected>1</option>
<option>2</option>
</select>
<br/>
<input type="text" name="hid" value="" class="box2" />
CSS
.box2 {
display:none;
}
JavaScript
$(".box1").change(function () {
var selected = $(this).find("option:selected").text();
$(".box2").val(selected);
if (selected === "0") {
$(".box2").show();
} else {
$(".box2").hide();
}
});