文本下拉列表,例如Google文本字段搜索 [英] text drop down list such in Google text field search
问题描述
我的代码不起作用..应该显示的选项不会出现.请帮助我
这是我的代码
在html中:
< input id ="txtSearchTag">
My code doesnt work.. the option that should be display wont appear.Please Help me
here my code
in html:
<input id="txtSearchTag">
function textSearchDdl()
{
var a;
jQuery(function(){
a = $('#txtSearchTag').autocomplete({
width: 300,
delimiter: /(,|;)\s*/,
lookup: 'January,February,March,April,May,June,July,August,September,October,November,December'.split(',')
});
//a.setOptions({ lookup: 'January,February,March,April,May,June,July,August,September,October,November,December'.split(',') });
});
}
并且我已经在html头部分中包含了以下代码:
< script src ="jquery.autocomplete.js" type ="text/javascript"></script>
and i already include this code in html head section:
<script src="jquery.autocomplete.js" type="text/javascript"></script>
推荐答案
(#txtSearchTag').autocomplete({ 宽度: 300 , 分隔符:/(,|;)\ s */, 查找:' 1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月' .split(' ,') }); // a.setOptions({查找:"1月,2月,3月,4月,5月,6月,7月,8月,九月,十月,十一月,十二月'.split(',')}); }); }
('#txtSearchTag').autocomplete({ width: 300, delimiter: /(,|;)\s*/, lookup: 'January,February,March,April,May,June,July,August,September,October,November,December'.split(',') }); //a.setOptions({ lookup: 'January,February,March,April,May,June,July,August,September,October,November,December'.split(',') }); }); }
并且我已经在html头部分中包含了以下代码:
< script src ="jquery.autocomplete.js" type ="text/javascript"></script>
and i already include this code in html head section:
<script src="jquery.autocomplete.js" type="text/javascript"></script>
似乎您已从某些地方复制粘贴了这些东西.您将自动完成功能用于固定数组的方式不正确.
试试这个:
It looks like you have copy-pasted the stuff from some where. Your way of using the autocomplete for fixed array is incorrect.
Try this:
<input id="txtSearchTag">
//directly put this in a script tag.
var a2;
a2 =
(' #months').autocomplete( { 宽度: 300 , 分隔符:/(,|;)\ s */, 查找:' 1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月' .split(' ,') })
('#months').autocomplete({ width: 300, delimiter: /(,|;)\s*/, lookup: 'January,February,March,April,May,June,July,August,September,October,November,December'.split(',') })
这不是必需的: jQuery(function(){
完成!
This is NOT needed: jQuery(function(){
Done!
这篇关于文本下拉列表,例如Google文本字段搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!