日期:2014-05-16 浏览次数:20399 次
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script>
$(function () {
input = $('#user_search');
input.bind("keyup", function () {
var value = $(this).val();
$('#all_user').find("option").each(function () {
debugger;
if (value == $(this).text()) {
this.selected = true;
}
else
this.selected = false;
})
});
})
</script>
</head>
<body>
<input type="text" id="user_search">
<select id="all_user">
<option id="a">a</option>
<option id="b">b</option>
<option id="c">c</option>
</select>
</body>
</html>