首页>>表单>>input支持自动查找内容(2016-11-20)

input支持自动查找内容

input支持自动查找内容
赞赏支持
立刻微信赞赏支持 关闭

 

JavaScript Code
  1. $('#demo1').typeahead({  
  2.                    source: [  
  3.                        {id: 1, name: 'Toronto'},  
  4.                        {id: 2, name: 'Montreal'},  
  5.                        {id: 3, name: 'New York'},  
  6.                        {id: 4, name: 'Buffalo'},  
  7.                        {id: 5, name: 'Boston'},  
  8.                        {id: 6, name: 'Columbus'},  
  9.                        {id: 7, name: 'Dallas'},  
  10.                        {id: 8, name: 'Vancouver'},  
  11.                        {id: 9, name: 'Seattle'},  
  12.                        {id: 10, name: 'Los Angeles'}  
  13.                    ],  
  14.                    onSelect: displayResult  
  15.                });  
XML/HTML Code
  1. <h3>Demo #1</h3>  
  2.                     <div class="well col-md-5">  
  3.                         <input id="demo1" type="text" class="col-md-12 form-control" placeholder="Search cities..." autocomplete="off" />  
  4.                     </div>  

 


原文地址:http://www.freejs.net/article_biaodan_589.html