input 与 select 结合使用

具体思路:input 短一点 ,select长一点 。input 在select 上层 露出下拉按钮 , 然后使用js 将 select
选中的值付给 input 。
HTML:

JS:

$('#select option').on('click', function() {
                document.getElementById('input').value=  
                document.getElementById('select').options[document.getElementById('select').selectedIndex].value;

})

你可能感兴趣的:(前端)