我为么我在搜索框里输入一个3但没有老师讲的会出现下拉框可选内容呢?比如会出现“360”几个字,哪个大神帮我看下,我写的代码哪里错了?
<body>
<div class="bg-div">
<div class="search-box">
<div class="logo"></div>
<form class="search-form" action="https://cn.bing.com/search" target="_blank" id="search-form" >
<input type="text" class="search-input-text" name="q" id="search_input" autocomplete="off" />
<input type="submit" class="search-input-button" value="" />
</form>
</div>
</div>
<div class="suggest" id="search-suggest" style="display:none">
<ul id="search-result">
<li>搜索结果1</li>
<li>搜索结果2</li>
</ul>
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
$('#search_input').bind('keyup',function(){
var searchText = $('#search_input').val();
$.get('http://api.bing.com/qsonhs.aspx?q='+searchText,function(d){
var d = d.AS.Results[0].Suggests;
var html='';
for(var i=0;i<d.length;i++){
html+='<li>'+d[i].Txt+'</li>';
}
$('#search-result').html(html);
$('#search-suggest').show().css({
top:$('#search-form').offset().top+$('#search-form').height() ,
left:$('#search-form').offset().left,
position:'absolute'
});
},'json');
})
$(document).bind('click',function(){
$('#search-suggest').hide();
});
</script>
</body>