当前位置: 首页 > 工具软件 > Typeahead.js > 使用案例 >

BootStrap-Typeahead.js的用法

钱志强
2023-12-01

 

 

    var aheadData = ["ANSHAN,鞍山市", "ANQING,安庆市", "ANYANG,安阳市", "ALASHANMENG,阿拉善盟", "ABAZHOU,阿坝州", "ANSHUN,安顺市", "ALIDIQU,阿里地区", "ANKANG,安康市", "AKESUDIQU,阿克苏地区", "ALETAIDIQU,阿勒泰地区", "ALAER,阿拉尔市", "BEIJING,北京市"];

    $("#" + id).typeahead({
        source: aheadData,
        highlighter: function (item) {
            var city = item.split(',')[1];
              return city;
              //显示的内容
        },
        updater: function (item) {

              //选择后事件
            var city = item.split(',')[1];


            return city;
        }

    });

 

 类似资料: