原文网址:
http://dhtmlexamples.com/2012/02/27/using-the-typeahead-plugin-with-twitter-bootstrap-2-and-jquery/
这个例子肯定能用,考到记事本里,然后另存为html,见证奇迹吧!

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Using the Typeahead plugin with Twitter Bootstrap 2 and jQuery</title>
<!-- http://dhtmlexamples.com/2012/02/27/using-the-typeahead-plugin-with-twitter-bootstrap-2-and-jquery/ -->
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" />
<style type="text/css">
body {
padding: 20px;
}
</style>
</head>
<body> <div class="container">
<input type="search" id="city" name="city" placeholder="Type a city name" data-provide="typeahead" class="search-query" />
</div> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-typeahead.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
var alCities = ['Baltimore', 'Boston', 'New York', 'Tampa Bay', 'Toronto', 'Chicago', 'Cleveland', 'Detroit', 'Kansas City', 'Minnesota', 'Los Angeles', 'Oakland', 'Seattle', 'Texas'].sort();
$('#city').typeahead({source: alCities, items:5});
});
</script> </body>
</html>

Twitter Typeahead plugin Example的更多相关文章

  1. twitter typeahead控件使用经历

    typeahead控件可以用于自动完成这个功能,在jQuery的UI中也有自动完成的控件.以前都是用jQuery UI中的自动完成的控件,但这次想用个轻量级的自动完成的控件,因此就调查了一下typeh ...

  2. bootstrap - typeahead自动补全插件

    $('#Sale').typeahead({ ajax: { url: '@Url.Action("../Contract/GetSale")', //timeout: 300, ...

  3. typeahead.js 使用记录

    github地址:https://github.com/twitter/typeahead.js 在aceAdmin界面模板中,有typeahead这一控件,版本号为0.10.2 , 这个版本对 mi ...

  4. 补充:学会Twitter Bootstrap不再难

    博客园的兄弟姐妹们很给力,自从这篇文章写出后,有人可能会对2.x版本升级到3.x版本的区别有些好奇和模糊.现在将官方给出的说明贴上去: 从2.x升级到3.0版本 Bootstrap 3并不向后兼容Bo ...

  5. 前端自动提示功能插件-typeahead

    typeahead https://npm.taobao.org/package/npm-typeahead A lightweight web-app that implements typeahe ...

  6. 第六章 使用 Bootstrap Typeahead 组件(百度下拉效果)(续)

    官方:http://twitter.github.io/typeahead.js/ 示例:http://twitter.github.io/typeahead.js/examples/(本文展示:Op ...

  7. 使用 jQuery.TypeAhead 让文本框自动完成 (四)(自定义模板)

    项目地址:https://github.com/twitter/typeahead.js 直接贴代码了: @section headSection { <script type="te ...

  8. 使用 jQuery.TypeAhead 让文本框自动完成 (三)(服务器返回 JSON 复杂对象数组)

    项目地址:https://github.com/twitter/typeahead.js 直接贴代码了: @section headSection { <script type="te ...

  9. 使用 jQuery.TypeAhead 让文本框自动完成 (二)(访问远程数据)

    项目地址:https://github.com/twitter/typeahead.js 直接贴代码了: @section headSection { <script type="te ...

随机推荐

  1. Oracle sql语句中不支持boolean类型(decode&case)

    [转自] http://blog.csdn.net/t0nsha/article/details/7828538 Oracle sql语句中不支持boolean类型(decode&case) ...

  2. python练习六十九:urllib爬取练习

    爬取图片,将链接中的图片取出来,并统计一共下载了多少图片 代码: def fetch_pictures(url): headers = {'User-Agent':'Mozilla/5.0 (Wind ...

  3. ELK 搭建实战

    一, 软件介绍 01,为什么用到ELK? 一般我们需要进行日志分析场景:直接在日志文件中 grep.awk 就可以获得自己想要的信息.但在规模较大的场景中,此方法效率低下,面临问题包括日志量太大 如何 ...

  4. 详细讲解Android的网络通信(HttpUrlConnection和HttpClient)

    前言,Android的网络通信的方式有两种:使用Socket或者HTTP,今天这一篇我们详细讲解使用HTTP实现的网络通信,HTTP又包括两种方式编程方式: (1)HttpUrlConnection: ...

  5. c#特性类 Attribute

    Attribute FYI Link: Attribute在.net编程中的应用(一) Attribute在.net编程中的应用(二) Attribute在.net编程中的应用(三) Attribut ...

  6. [ElasticSearch] 如何使用中文分詞ik與繁簡轉換stconvert插件

    一. 環境安裝 ElasticSearch(以下簡稱ES)安裝已經算相對簡單了, 但要使用需要配置的插件, 對剛入門的新手還是有點麻煩, 所幸medcl大神提供一個配置好的ES-rtf版本, 新手們在 ...

  7. [Matlab] Galois Field arrays

    Operations supported for Galois Field arrays: + - - Addition and subtraction of Galois arrays. * / \ ...

  8. nyoj 791——Color the fence——————【贪心】

    Color the fence 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述 Tom has fallen in love with Mary. Now Tom w ...

  9. MySql存储引擎MyISAM和InnoDB的区别

    1.MySQL默认采用的是MyISAM. 2.MyISAM不支持事务,而InnoDB支持.InnoDB的AUTOCOMMIT默认是打开的,即每条SQL语句会默认被封装成一个事务,自动提交,这样会影响速 ...

  10. IntelliJ IDEA 12 设置优化

    1.IntelliJ IDEA简介 IntelliJ IDEA是Eclipse之外又一强大的IDE,Google在今年发布了新的Android开发IDE---Android Studio就是基于Int ...