<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>下拉菜单</title>
<style text/css>
*{padding: 0;margin: 0;}
li{list-style: none;}
div{width: 200px;height: 30px;position: relative;margin: 0 auto;}
.txt{display: block;width: 200px;height: 30px;}
.list{width: 200px;height: 306px;border: 1px solid blue;
display: none;position: absolute;}
.list li{height: 50px;border-bottom: 1px solid #ccc;ine-height: 50px;}
</style>
<script src="js/jquery-1.11.0.js"></script>
</head>
<body>
<div>
<input type="text" class="txt" placeholder="请输入文字"/>
<ul class="list">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</div>
<script>
$(function(){
$(".txt").on("click",function(){
$(".list").css("display","block")
})
$(".list li").click(function(){
var val = $(this).html();
$(".txt").val(val)
$(".list").css("display","none")
})
})
</script>
</body>
</html>