github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 403
    • 52
  • Source
  • Commits
  • Network (52)
  • Graphs
  • Tree: 6a59746

click here to add a description

click here to add a homepage

  • Switch Branches (6)
    • bind
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
  • Switch Tags (16)
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Autocomplete: Added demo for accent folding.
Proof of concept for #5219 - Autocomplete: Support for accent-folding.
scottgonzalez (author)
Wed Apr 21 07:02:53 -0700 2010
commit  6a59746d1d97cb24bafe
tree    e0d67a1d209fca8f2405
parent  32bcf56584b81172fd98
A demos/autocomplete/folding.html 64 •••••
Txt demos/autocomplete/folding.html
  • View file @ 6a59746
... ...
@@ -0,0 +1,64 @@
  1
+<!DOCTYPE html>
  2
+<html lang="en">
  3
+<head>
  4
+  <meta charset="UTF-8" />
  5
+  <title>jQuery UI Autocomplete Accent Folding Demo</title>
  6
+  <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
  7
+  <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
  8
+  <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
  9
+  <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
  10
+  <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
  11
+  <script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
  12
+  <link type="text/css" href="../demos.css" rel="stylesheet" />
  13
+  <script type="text/javascript">
  14
+  $(function() {
  15
+    var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];
  16
+
  17
+    var accentMap = {
  18
+      'á':'a',
  19
+      'ö':'o'
  20
+    };
  21
+    var normalize = function( term ) {
  22
+      var ret = '';
  23
+      for ( var i = 0; i < term.length; i++ ) {
  24
+        ret += accentMap[ term.charAt(i) ] || term.charAt(i);
  25
+      }
  26
+      return ret;
  27
+    };
  28
+
  29
+    $( "#developer" ).autocomplete({
  30
+      source: function( request, response ) {
  31
+        var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
  32
+        response( $.grep( names, function( value ) {
  33
+          value = value.label || value.value || value;
  34
+          return matcher.test( value ) || matcher.test( normalize( value ) );
  35
+        }) );
  36
+      }
  37
+    });
  38
+  });
  39
+  </script>
  40
+</head>
  41
+<body>
  42
+
  43
+<div class="demo">
  44
+
  45
+<div class="ui-widget">
  46
+  <form>
  47
+  <label for="developer">Developer: </label>
  48
+  <input id="developer" />
  49
+  </form>
  50
+</div>
  51
+
  52
+</div><!-- End demo -->
  53
+
  54
+<div class="demo-description">
  55
+<p>
  56
+The autocomplete field uses a custom source option which will match results that have accented characters even when the text field doesn't contain accented characters. However if the you type in accented characters in the text field it is smart enough not to show results that aren't accented.
  57
+</p>
  58
+<p>
  59
+Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".
  60
+</p>
  61
+</div><!-- End demo-description -->
  62
+
  63
+</body>
  64
+</html>

0 notes on commit 6a59746

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server