案例:jQuery UI案例     状态:可编辑再运行    进入横版
AخA
          ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
 
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta charset="utf-8">
5
  <title>jQuery UI 自动完成(Autocomplete) - 分类</title>
6
  <link rel="stylesheet" href="/css/jqu1.10.4/jquery-ui.min.css">
7
  <script src="/js/jqu/jquery.min1.10.2.js"></script>
8
  <script src="/js/jqu/jquery-ui.min1.10.4.js"></script>
9
  <link rel="stylesheet" href="jqueryui/style.css">
10
  <style>
11
  .ui-autocomplete-category {
12
    font-weight: bold;
13
    padding: .2em .4em;
14
    margin: .8em 0 .2em;
15
    line-height: 1.5;
16
  }
17
  </style>
18
  <script>
19
  $.widget( "custom.catcomplete", $.ui.autocomplete, {
20
    _renderMenu: function( ul, items ) {
21
      var that = this,
22
        currentCategory = "";
23
      $.each( items, function( index, item ) {
24
        if ( item.category != currentCategory ) {

 运行结果 
 北美留学生论坛