Autocomplete Without jQuery UI Autocomplete Without jQuery UI ajax ajax

Autocomplete Without jQuery UI


You can use HTML5 'list' attribute in your input textbox and provide it a custom list of values by using datalist.

<!DOCTYPE html><html><head><!--your stuff--></head><body><!--your stuff--><input type="text" id="txtAutoComplete" list="languageList"/><!--your input textbox--><datalist id="languageList"><option value="HTML" /><option value="CSS" /><option value="JavaScript" /><option value="SQL" /><option value="PHP" /><option value="jQuery" /><option value="Bootstrap" /><option value="Angular" /><option value="ASP.NET" /><option value="XML" /></datalist></body></html>

If you didn't get it, Read more at http://www.cheezycode.com/2015/09/create-auto-complete-dropdown-using.html

There's a video as well for it Auto-Complete Without JQuery


You can use the Ajax Autocomplete for jQuery plugin

And here is the full documentation

Code

SCRIPT

<script src="http://code.jquery.com/jquery-1.9.1.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.devbridge-autocomplete/1.2.24/jquery.autocomplete.min.js"></script><script>   a1 = $('#query').autocomplete({         width: 448,         delimiter: /(,|;)\s*/,         lookup: 'Andorra,Azerbaijan,Bahamas,Bahrain,Benin,Bhutan,Bolivia,Bosnia Herzegovina,Botswana,Brazil,Brunei,Bulgaria,Burkina, Burundi,Cambodia,Cameroon,Canada,Cape Verde,Central African Rep,Chile,China,Colombia,Comoros,Congo,Congo {Democratic Rep},Costa Rica,Croatia,Cuba,Cyprus,Czech Republic,Denmark,Djibouti,East Timor,Ecuador,Egypt,El Salvador,Equatorial Guinea,Eritrea,Fiji,France,Georgia,Germany,Ghana,Greece,Grenada,Guatemala,Guinea,Guinea-Bissau,Guyana,Haiti,Honduras,Hungary,India,Iraq,Ireland {Republic},Ivory Coast,Jamaica,Japan,Kazakhstan,Kiribati,Korea North,'.split(',')      });     </script>

CSS

.text-field {    -moz-box-sizing: border-box;    border: 1px solid #EEEEEE;    font-family: "Source Sans Pro",Arial,sans-serif;    font-size: 0.73684em;    font-weight: 600;    height: 37px;    margin: 0;    padding: 5px;    width: 100%;}.autocomplete-suggestion {    overflow: hidden;    padding: 2px 5px;    white-space: nowrap;}.autocomplete-suggestions strong {    color: #3399FF;    font-weight: normal;}.autocomplete-selected{  background:#F0F0F0;}

HTML

 <input type="text" id="query" class="text-field valid" autocomplete="off" placeholder="Search here">

I created a demo of autocomplete here is the link jsbin.com


Here is one little autocomplete plugin written by me, please try: https://github.com/Fischer-L/autoComplt

Because I am not using jQuery and don't want to include some big libs just for one feature, I write for myself.

This plugin doesn't depend on other libs and doesn't have to include other CSS, so just including one JS script is enough.

P.S If you use it and find some thing which needs to be improved, please tell me :)