<div style="padding:5px ;position:relative" class="col-sm-4">
<span style="position:absolute;top:5px;overflow:hidden;width:95%;height:32px;">
<!--这个是个多选框,用onchange事件的时候 ,将这个select的id传进去-->
<select name="trains" onchange="qlcTrainS('hn_select_input')" class="form-control" id="hn_select_input" style="height:30px;outline:0;">
<option value="test1">test1</option>
<option value="test2">test2</option>
<option value="test3">test3</option>
<option value="test4">test4</option>
<option value="test5">test5</option>
</select>
</span>
<span style="position:absolute;top:7px;left:10px;margin-top:1px;margin-left:1px;width:80%;height:28px;border-radius:5px;">
<!--这里是input框,定位到select的上面-->
<input type="text" name="ccdd" id="hn_input_value" class="ccdd" placeholder="可选择也可输入的下拉框" style="width:80%;height:24px;border:0pt;border-radius:5px;outline:0">
</span>
</div>
<script>
<!--将select的值赋给input框-->
function qlcTrainS(selectIdName) {
var arrValue=document.getElementById(selectIdName).options[document.getElementById(selectIdName).selectedIndex].value;
console.log(arrValue)
$("#"+selectIdName+"").parent('span').next('span').children('input.ccdd').val(arrValue)
}
</script>