原文网址:
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. 【研究】XML外部实体注入(XXE)

    在正式发布的2017 OWAST Top10榜单中,出现了三种新威胁: A4:XML外部实体注入漏洞(XXE) A8:不安全的反序列化漏洞 A10:不足的记录和监控漏洞 验证XXE: 构造请求 < ...

  2. MySQL 小抄

    1. 登录 mysql - u root -pEnter Password: 2. 查询端口 mysql> show global variables like "port" ...

  3. js - cannot set property xxx of undefined

    for(let i=0;i<=res.data.length;i++){ res.data[i]['class'] = 'biaoqian-red'; } console.log(res.dat ...

  4. Docker 命令详解(run篇)

    参考:https://www.cnblogs.com/yfalcon/p/9044246.html 命令格式:docker run [OPTIONS] IMAGE [COMMAND] [ARG...] ...

  5. ajax请求方法及参数说明

    $.ajax()请求示例 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

  6. Go初探

      官方网站:https://golang.org/ 标准库文档:https://golang.org/pkg/ 在线编码学习:https://play.golang.org/ PS:请自行FQ 简介 ...

  7. web部署启动或者运行报错查看日志寻找问题方法

    今天运行一个项目,启动报错,查看日志,只看到了前半段错误日志,根据前半段错误日志差查找原因,找了两个小时,也没有解决掉,最后根据后半段错误日志十分钟定位错误,给解决了,以后出现问题不能急躁,查看完成的 ...

  8. java poi reader常用API汇总

    注意:(1)判断行的最大数量建议使用sheet.getLastRowNum();(2)判断每行最大列数建议使用row.getLastCellNum(); [JAVA]特别注意,POI中getLastR ...

  9. IIS7部署网站出现500.19错误(权限不足)的解决方案

    错误摘要 HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息 模块 IIS Web Core 通知 未知 处理 ...

  10. [LeetCode]21. Merge Two Sorted Lists合并两个有序链表

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...