/[projects]/misc/horsensspejder-web/jquery/jquery-ui-1.10.3/demos/autocomplete/folding.html
ViewVC logotype

Annotation of /misc/horsensspejder-web/jquery/jquery-ui-1.10.3/demos/autocomplete/folding.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (hide annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 4 months ago) by torben
File MIME type: text/html
File size: 1832 byte(s)
initial import
1 torben 2125 <!doctype html>
2     <html lang="en">
3     <head>
4     <meta charset="utf-8">
5     <title>jQuery UI Autocomplete - Accent folding</title>
6     <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7     <script src="../../jquery-1.9.1.js"></script>
8     <script src="../../ui/jquery.ui.core.js"></script>
9     <script src="../../ui/jquery.ui.widget.js"></script>
10     <script src="../../ui/jquery.ui.position.js"></script>
11     <script src="../../ui/jquery.ui.menu.js"></script>
12     <script src="../../ui/jquery.ui.autocomplete.js"></script>
13     <link rel="stylesheet" href="../demos.css">
14     <script>
15     $(function() {
16     var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];
17    
18     var accentMap = {
19     "á": "a",
20     "ö": "o"
21     };
22     var normalize = function( term ) {
23     var ret = "";
24     for ( var i = 0; i < term.length; i++ ) {
25     ret += accentMap[ term.charAt(i) ] || term.charAt(i);
26     }
27     return ret;
28     };
29    
30     $( "#developer" ).autocomplete({
31     source: function( request, response ) {
32     var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
33     response( $.grep( names, function( value ) {
34     value = value.label || value.value || value;
35     return matcher.test( value ) || matcher.test( normalize( value ) );
36     }) );
37     }
38     });
39     });
40     </script>
41     </head>
42     <body>
43    
44     <div class="ui-widget">
45     <form>
46     <label for="developer">Developer: </label>
47     <input id="developer">
48     </form>
49     </div>
50    
51     <div class="demo-description">
52     <p>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.</p>
53     <p>Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".</p>
54     </div>
55     </body>
56     </html>

  ViewVC Help
Powered by ViewVC 1.1.20