Sep 22, 2014 in Autocomplete 5047 views
Autocomplete.js is jQuery plugin that improve your search with hints.
Source: lorecioni.github.io
1. INCLUDE CSS AND JS FILES
<link rel="stylesheet" href="css/autocomplete.css" type="text/css"> <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <script src="js/autocomplete.js"></script>
2. HTML
<div id="search-form"></div> <div id="message">Selection</div>
3. JAVASCRIPT
var proposals = ['boat', 'bear', 'dog', 'drink', 'elephant', 'fruit']; $(document).ready(function(){ $('#search-form').autocomplete({ hints: proposals, width: 300, height: 30, onSubmit: function(text){ $('#message').html('Selected: <b>' + text + '</b>'); } }); });
4. OPTIONS
Tagged with:
autocomplete.js
jquery plugin
search hints
hints
placeholder
autocomplete
search
Related Articles