1 | <!doctype html>
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <title>Autocomplete Visual Test: Default</title>
|
---|
5 | <link rel="stylesheet" href="../visual.css" type="text/css" />
|
---|
6 | <link rel="stylesheet" href="../../../themes/base/ui.base.css" type="text/css" />
|
---|
7 | <link rel="stylesheet" href="../../../themes/base/ui.theme.css" type="text/css" title="ui-theme" />
|
---|
8 | <script type="text/javascript" src="../../../jquery-1.4.1.js"></script>
|
---|
9 | <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
|
---|
10 | <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
|
---|
11 | <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
|
---|
12 | <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
|
---|
13 | <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
|
---|
14 | <script type="text/javascript">
|
---|
15 | $(function() {
|
---|
16 | $.fn.themeswitcher && $('<div/>').css({
|
---|
17 | position: "absolute",
|
---|
18 | right: 10,
|
---|
19 | top: 10
|
---|
20 | }).appendTo(document.body).themeswitcher();
|
---|
21 |
|
---|
22 | function log(message) {
|
---|
23 | $("<div/>").text(message).prependTo("#log");
|
---|
24 | $("#log").attr("scrollTop", 0);
|
---|
25 | }
|
---|
26 |
|
---|
27 | function enable() {
|
---|
28 | $("#tags").autocomplete({
|
---|
29 | source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"],
|
---|
30 | delay: 0,
|
---|
31 | search: function() {
|
---|
32 | log("Searching for: " + this.value);
|
---|
33 | },
|
---|
34 | open: function() {
|
---|
35 | log("Found something");
|
---|
36 | },
|
---|
37 | focus: function(event, ui) {
|
---|
38 | log("Moving focus to " + ui.item.label);
|
---|
39 | },
|
---|
40 | close: function() {
|
---|
41 | log("Hiding suggestions");
|
---|
42 | },
|
---|
43 | change: function(event, ui) {
|
---|
44 | log(ui.item ? ("Selected: " + ui.item.value) : "Nothing selected, input was " + this.value);
|
---|
45 | }
|
---|
46 | });
|
---|
47 | }
|
---|
48 | enable();
|
---|
49 | $("#toggle").toggle(function() {
|
---|
50 | $("#tags").autocomplete("destroy");
|
---|
51 | }, enable);
|
---|
52 | });
|
---|
53 | </script>
|
---|
54 | </head>
|
---|
55 | <body>
|
---|
56 |
|
---|
57 | <div class="ui-widget">
|
---|
58 | <label for="tags">Tags: </label>
|
---|
59 | <input class="ui-widget ui-widget-content ui-corner-all" id="tags" />
|
---|
60 | </div>
|
---|
61 | <div>
|
---|
62 | <label for="tags">Select: </label>
|
---|
63 | <select>
|
---|
64 | <option>label</option>
|
---|
65 | </select>
|
---|
66 | </div>
|
---|
67 |
|
---|
68 | <div class="ui-widget" style="margin-top:2em; font-family:Arial">
|
---|
69 | Log:
|
---|
70 | <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
|
---|
71 | </div>
|
---|
72 |
|
---|
73 | <button id="toggle">Toggle widget</button>
|
---|
74 |
|
---|
75 | </body>
|
---|
76 | </html>
|
---|