A jQuery auto complete plugin.
Include files:
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link rel="stylesheet" href="/path/to/completer.css">
<script src="/path/to/completer.js"></script>
Initialize with $.fn.completer
method.
<input class="completer" type="email">
$(".completer").completer({
source: ["gmail.com", "yahoo.com", "hotmail.com", "outlook.com", "live.com", "aol.com"],
separator: "@"
});
Setup with $("#target").completer(options)
, or global setup with $.fn.completer.setDefaults(options)
.
- type: function
- default:
function() {}
Will be run when complete.
- type: string
- default: "li"
The element tag of list item.
- type: function
- default:
function(val) { return val; }
The function will be passed the input value and run before show the list.
- type: string
- options: "top", "right", "bottom", "left"
- default: "bottom"
The position of the container.
- type: array
- default: []
The source data for complete or suggest.
- type: string
- default: "completer-selected"
A jQuery selector string, highlight the item when it's selected.
- type: string
- default: ""
This will be added between the value and attachment.
- type: boolean
- default: false
Set it "true" to start the suggestion mode.
- type: string
- default: "<ul class="completer-container">
The container of the completer.
- type: number
- default: 1
The css "z-index" property for the container.