模糊查询插件jquery-autocomplete

script src="js/jquery/jquery-1.7.1.min.js"></script>
<script src="js/jquery/jquery.ui.core.min.js"></script>
<script src="js/jquery/jquery.ui.widget.min.js"></script>
<script src="js/jquery/jquery.ui.position.min.js"></script>
<script src="js/jquery/jquery.ui.autocomplete.min.js"></script>

<link rel="stylesheet" href="js/jquery/smoothness/jquery-ui-1.8.16.custom.css"/>

// Valid JSON data:
{"label" : "Samwise Gamgee"}

// Invalid JSON data:
{"label" : Samwise Gamgee}


<script>var data = [
		{"label" : "Aragorn"},
		{"label" : "Arwen"},
		{"label" : "Bilbo Baggins"},
		{"label" : "Boromir"},
		{"label" : "Frodo Baggins"},
		{"label" : "Gandalf"},
		{"label" : "Gimli"},
		{"label" : "Gollum"},
		{"label" : "Legolas"},
		{"label" : "Meriadoc Merry Brandybuck"},
		{"label" : "Peregrin Pippin Took"},
		{"label" : "Samwise Gamgee"}
		];
</script>

<script>
$(function() {

	$( "#search" ).autocomplete(
	{
		 source:data
	})
});
</script>

<input type="text" id="search" />
----------

相关推荐