jQuery UI Autocomplete 实例
<script type="text/javascript">
$(function () {
$('#city_name').autocomplete({
// max:5,
// width:210,
// scrollHeight:300,
minLength:2,
source:$.parseJSON($("#city_date").val()),
select:function (e, ui) {
$("#city_id").val(ui.item.value);
$('#city_name').val(ui.item.label+", "+ui.item.desc)
return false
},
focus:function (e, ui) {
$('#city_name').val(ui.item.label)
return false
}
}).data("autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a style='margin-left: 2px;'><span>" + item.label + "</span><span style='margin-right: 2px; float:right; color:#08C;'>" + item.desc + "</span><a>")
.appendTo(ul);
};
});
</script> 相关推荐
gufudhn 2020-06-12
yaohustiAC 2019-12-27
pythonclass 2019-11-07
geminihr 2015-03-19
仲崇峰 2015-06-02
83453065 2015-07-22
hubowei 2015-07-22
原為簡單 2017-02-21
87433764 2017-02-21
小肖 2017-05-12
89453862 2017-09-16
delmarks 2017-02-21
yesbuy00 2017-02-08
85403969 2016-10-25
gamecalo 2016-10-08
Web全栈笔记 2016-10-08
Kindlecode 2016-05-25