{"id":17393,"date":"2017-06-21T16:22:13","date_gmt":"2017-06-21T13:22:13","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=17393"},"modified":"2018-01-08T13:12:10","modified_gmt":"2018-01-08T11:12:10","slug":"bootstrap-autocomplete-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/","title":{"rendered":"Bootstrap Autocomplete Example"},"content":{"rendered":"<p>In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and improves usability because user can select a suggestion rather than typing it in. To implement this autocomplete we will use Bootstrap modal window. As a result the user can either press the Enter key or click with mouse to select a suggestion. In addition the number of suggestions will be limited to a maximum of four. So, let&#8217;s get started!<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;57DHuNTHJ2qczaGz&#8217;]<br \/>\n&nbsp;<\/p>\n<h2>1. Tools<\/h2>\n<p>Following tools will be used to build this example:<\/p>\n<ul>\n<li><a href=\"http:\/\/getbootstrap.com\/getting-started\/#download\">Bootstrap v3.3.7<\/a><\/li>\n<li><a href=\"https:\/\/blog.jquery.com\/2016\/05\/20\/jquery-1-12-4-and-2-2-4-released\/\">JQuery v1.12.4<\/a><\/li>\n<li><a href=\"https:\/\/nodejs.org\/en\/download\/\">Node.js v6.3.0<\/a><\/li>\n<li><a href=\"https:\/\/code.visualstudio.com\/download\">Visual Studio Code IDE<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/express\">Express Module<\/a><\/li>\n<\/ul>\n<p>In addition to the above, I have also used a dataset for list of pizza toppings from\u00a0<a href=\"https:\/\/github.com\/dariusk\/corpora\/blob\/master\/data\/foods\/pizzaToppings.json\">Corpora<\/a><\/p>\n<p>Bootstrap is a front-end framework for designing responsive websites. We also include JQuery since Bootstrap needs it. The JQuery library makes writing JavaScript a breeze. Node.js in essence is JavaScript on the server-side. The Express module is used to create a server to serve files and resources to the browser.<\/p>\n<h2>2. Project Structure<\/h2>\n<p>The project assets are stored as follows<\/p>\n<figure id=\"attachment_17459\" aria-describedby=\"caption-attachment-17459\" style=\"width: 486px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure.jpg\"><img decoding=\"async\" class=\"size-full wp-image-17459\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure.jpg\" alt=\"Project Structure\" width=\"486\" height=\"495\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure.jpg 486w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure-295x300.jpg 295w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure-70x70.jpg 70w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/a><figcaption id=\"caption-attachment-17459\" class=\"wp-caption-text\">Project Structure<\/figcaption><\/figure>\n<p><strong><em>css<\/em><\/strong>: The css folder holds the bootstrap css files downloaded from Bootstrap Website.<\/p>\n<p><strong><em>dataset<\/em><\/strong>: We keep the dataset file from Corpora in the dataset folder.<\/p>\n<p><strong><em>fonts<\/em><\/strong>: The fonts which accompany the bootstrap css files are placed in this folder.<\/p>\n<p><strong><em>js<\/em><\/strong>: All JavaScript files, including the ones we create, and also bootstrap files go into this folder.<\/p>\n<p><strong><em>index.html<\/em><\/strong>: This is the root page on which we see the Autocomplete example in action. I borrowed the initial from Bootstrap Getting Started section and then customized it to the project&#8217;s requirements.<\/p>\n<p><strong><em>bootstrap.autocomplete.js<\/em><\/strong>: This JavaScript files contains our code to enable the autocomplete feature.<\/p>\n<p><strong><em>index.js<\/em><\/strong>: This file is the entry point of our application.<\/p>\n<h2>3. HTML Markup<\/h2>\n<p>To begin, we add an input tag decorated with the attribute <code>data-autocomplete<\/code> with value <code>pizzaToppings<\/code> to the HTML page and a corresponding label. As a result our index.html page looks like below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>index.html<\/em><\/span><\/p>\n<pre class=\"brush:html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=\"utf-8\"&gt;\r\n&lt;meta http-equiv=\"X-UA-Compatible\"content=\"IE=edge\"&gt;\r\n&lt;meta name=\"viewport\"content=\"width=device-width, initial-scale=1\"&gt;\r\n&lt;!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;\r\n&lt;title&gt;Bootstrap Autocomplete Example - Web Code Geeks&lt;\/title&gt;\r\n\r\n&lt;!-- Latest compiled and minified CSS --&gt;\r\n&lt;link rel=\"stylesheet\"href=\"\/css\/bootstrap.min.css\"&gt;\r\n\r\n&lt;!-- Optional theme --&gt;\r\n&lt;linkrel=\"stylesheet\"href=\"\/css\/bootstrap-theme.min.css\"&gt;\r\n&lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;\r\n&lt;!-- WARNING: Respond.js doesn't work if you view the page via file:\/\/ --&gt;\r\n&lt;!--[if lt IE 9]&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/html5shiv\/3.7.3\/html5shiv.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/respond\/1.4.2\/respond.min.js\"&gt;&lt;\/script&gt;\r\n&lt;![endif]--&gt;\r\n\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;div class=\"panel panel-info\"&gt;\r\n&lt;div class=\"panel-heading\"&gt;\r\n&lt;h1&gt;WebCodeGeeks - Bootstrap Autocomplete&lt;\/h1&gt;\r\n&lt;\/div&gt;\r\n&lt;div class=\"panel-body\"&gt;\r\n&lt;div class=\"form-group\"&gt;\r\n&lt;label for=\"favoritepizzatoppings\"&gt;Favorite Pizza Topping&lt;\/label&gt;\r\n&lt;input class=\"form-control\" id=\"favoritepizzatoppings\" data-autocomplete=\"pizzaToppings\" placeholder=\"Enter favorite pizza topping...\"autocomplete=\"off\" \/&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\u00a0\r\n\r\n&lt;!-- jQuery (necessary for Bootstrap's JavaScript plugins) --&gt;\r\n&lt;scriptsrc=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.12.4\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n\r\n&lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;\r\n&lt;!-- Latest compiled and minified JavaScript --&gt;\r\n&lt;script src=\".\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\".\/js\/bootstrap.autocomplete.js\"&gt;&lt;\/script&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.badge{\r\nmargin-left:5px;\r\n}\r\n.modal{\r\nright:auto;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h2>4. JavaScript<\/h2>\n<p>In this section we will write the JavaScript required to enable the autocomplete feature. Lets go through the JavaScript functions one by one and learn what each one does.<\/p>\n<h3>4.1. Get Suggestions List<\/h3>\n<p>First of all we loop over input tags decorated with <code>data-autocomplete<\/code> attribute while fetching list of suggestions for each. Since we are accessing DOM elements the page needs to be rendered completely therefore we write the code in JQuery document ready callback.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">var suggestions = {};\r\n\r\nvar autocompleteWidget;\r\n$(document).ready(function () {\r\n\r\n\/\/Iterate over all the input tags in the document with an attribute data-autocomplete\r\n$.each($(\"input[data-autocomplete]\"), function (index, item) {\r\nvar entityName = $(item).attr('data-autocomplete');\r\nfetchSuggestionsFromServer('\/dataset\/' + entityName + '.js', entityName);\r\n});\r\n});<\/pre>\n<h3>4.2. Add click event handler for suggestions<\/h3>\n<p>Then we bind to click event of each suggestion because when a suggestion is clicked we want to populate its value in the input tag and close the suggestions list.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">\/\/Bind to click event of each suggestion displayed and populate the input tag with its value on click\r\n$(document).on(\"click\", \"a.list-group-item\", function (e) {\r\nvar code = e.code || e.which;\r\nvar target = e.target;\r\nif ( code !== 1 || !autocompleteWidget || !target) return;\r\n$(autocompleteWidget[\"wcg-autocomplete-input\"]).val($(target).text());\r\n$(autocompleteWidget).modal('hide');\r\n});\r\n<\/pre>\n<h3>4.3. Setup Input Tags<\/h3>\n<p>Finally we call the method that makes the magic. This method sets up each input tag so that a suggestions list can be displayed when the user enters data into them.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">\/\/Setup the input tags to display suggestions by binding to their keyup event\r\nautocompleteSetup();\r\n<\/pre>\n<h4>4.3.1. autocompleteSetup Function<\/h4>\n<p>Here we handle the keyup event of each input. So that we can handle Up or Down Arrow keys as well as Enter key pressed by a user. We move the highlighting among suggestions according to the Arrow key pressed. But if Enter key is pressed we populate the selected suggestion in the input. In case of any other key we update the list of displayed suggestions.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">function autocompleteSetup() {\r\n$(document).on(\"keyup\", \"input[data-autocomplete]\", function (event) {\r\nvar code = event.code || event.which;\r\n\r\n\/\/If the user presses the up arrow or down arrow key, move the selected suggestion as well\r\nif (code === 38) {\r\nvar next = $(\"a.list-group-item.active\").prev();\r\n\r\nif (next) {\r\n$(\"a.list-group-item.active\").removeClass(\"active\");\r\n$(next).addClass(\"active\");\r\n\r\n}\r\nreturn;\r\n\r\n} else if (code === 40) {\r\nvar prev = $(\"a.list-group-item.active\").next();\r\nif (prev) {\r\n$(\"a.list-group-item.active\").removeClass(\"active\");\r\n$(prev).addClass(\"active\");\r\n}\r\nreturn;\r\n}\r\n\r\n\/\/Display suggestions based on what the user has typed in so far\r\nif (code !== 13){\r\ndisplaySuggestions(getSuggestions($(this).val(), this), this);\r\n}\r\n\r\n\/\/If the user clicks the Enter key\r\nif (code === 13 &amp;&amp; autocompleteWidget) {\r\n$(this).val($(\"a.list-group-item.active\").text());\r\n$(autocompleteWidget).modal('hide');\r\n}\r\n\r\n});\r\n};\r\n<\/pre>\n<h4>4.3.2. getSuggestions Function<\/h4>\n<p>This function creates the Html markup with the list of matching suggestions. Then it shows it as a Bootstrap modal window under the input tag that it has passed to it.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">function getSuggestions(searchTerm, element) {\r\nvar suggestionList = \"\";\r\nvar firstSuggestion = \"&lt;a class='list-group-item active'&gt;\";\r\nvar suggestion = \"&lt;a class='list-group-item'&gt;\";\r\n\r\nif (searchTerm === \"\") {\r\nreturn \"\";\r\n}\r\nvar list = $.grep(suggestions[$(element).attr('data-autocomplete')], function (s) {\r\nreturn s.toLowerCase().indexOf(searchTerm.toLowerCase()) === 0;\r\n});\r\n\r\n\r\n$.each(list.slice(0, (list.length &gt; 5 ? 4 : list.length)), function (index, item) {\r\nif (index === 0) {\r\nsuggestionList = suggestionList + firstSuggestion + item + \"&lt;\/a&gt;\";\r\n} else {\r\nsuggestionList = suggestionList + suggestion + item + \"&lt;\/a&gt;\";\r\n}\r\n\r\n}, this);\r\n\r\nsuggestionList = suggestionList;\r\nreturn suggestionList;\r\n\r\n};\r\n<\/pre>\n<h4>4.3.3. Get Suggestions from Server<\/h4>\n<p>Using JQuery&#8217;s <code>getJSON<\/code> function we request the suggestions list and store it in the suggestions object. The suggestions object stores each input tags suggestions in a separate key-value pair. The key is value of the <code>data-autocomplete<\/code> attribute and value is the list of suggestions.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">function fetchSuggestionsFromServer(suggestionsUrl, suggestionsFor) {\r\n\r\nif(suggestions.hasOwnProperty(suggestionsFor)){\r\nreturn;\r\n}\r\n$.getJSON(suggestionsUrl, function (response) {\r\nsuggestions[suggestionsFor] = response[suggestionsFor];\r\n});\r\n\r\n}\r\n<\/pre>\n<h4>4.3.4. Display Suggestions<\/h4>\n<p>This method displays the markup with the list of suggestions passed to it by creating a new or updating the existing autocomplete modal window. The modal window is also positioned under the related element.<\/p>\n<p><span style=\"text-decoration: underline\"><em>bootstrap.autocomplete.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">function displaySuggestions(suggestions, element) {\r\n\r\nif (suggestions.length === 0) {\r\n\r\nif (autocompleteWidget) $(autocompleteWidget).modal('hide');\r\n\r\nreturn;\r\n}\r\nvar suggDiv;\r\nif (autocompleteWidget) {\r\nsuggDiv = $(autocompleteWidget);\r\n}\r\nelse {\r\nsuggDiv = $(\"&lt;div id='wcg-modal' class='modal fade' data-backdrop='false'&gt;&lt;\/div&gt;\");\r\n}\r\n\r\nsuggDiv.html(suggestions);\r\n\r\nif (!autocompleteWidget) {\r\n$(document.body).append(suggDiv);\r\n\r\nautocompleteWidget = suggDiv;\r\n}\r\n$(autocompleteWidget).css({\r\nleft: $(element).position().left + \"px\",\r\ntop: $(element).position().top + $(element).height() + 8 + \"px\"\r\n});\r\nautocompleteWidget[\"wcg-autocomplete-input\"] = element;\r\n$(autocompleteWidget).modal('show');\r\n};\r\n<\/pre>\n<h2>5. Running the Project<\/h2>\n<p>To run the project we type the following in a command window at the root of the project:<\/p>\n<pre class=\"brush:bash\">project root&gt;npm install<\/pre>\n<pre class=\"brush:bash\">project root&gt;node index.js<\/pre>\n<h2>6. Output<\/h2>\n<p>Navigate to the URL <code>http:\/\/localhost:3000\/<\/code> in a browser and you should see the following output.<\/p>\n<figure id=\"attachment_17461\" aria-describedby=\"caption-attachment-17461\" style=\"width: 766px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure-1.jpg\"><img decoding=\"async\" class=\"wp-image-17461 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure-1.jpg\" alt=\"\" width=\"766\" height=\"457\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure-1.jpg 766w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/ProjectStructure-1-300x179.jpg 300w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/a><figcaption id=\"caption-attachment-17461\" class=\"wp-caption-text\">Project Output<\/figcaption><\/figure>\n<h2>7. Download the Source Code<\/h2>\n<p>This wraps up the Bootstrap Autocomplete Example.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/06\/WCG-Bootstrap-Autocomplete-Example.zip\"><strong>Bootstrap Autocomplete Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and improves usability because user can select a suggestion rather than typing it in. To implement this autocomplete we will use Bootstrap modal window. As a result the user can either press the &hellip;<\/p>\n","protected":false},"author":213,"featured_media":8515,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[284],"tags":[376],"class_list":["post-17393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bootstrap","tag-bootstrap"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Bootstrap Autocomplete Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bootstrap Autocomplete Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-21T13:22:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-08T11:12:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Siddharth Seth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siddharth Seth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\"},\"author\":{\"name\":\"Siddharth Seth\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\"},\"headline\":\"Bootstrap Autocomplete Example\",\"datePublished\":\"2017-06-21T13:22:13+00:00\",\"dateModified\":\"2018-01-08T11:12:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\"},\"wordCount\":779,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"keywords\":[\"bootstrap\"],\"articleSection\":[\"Bootstrap\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\",\"name\":\"Bootstrap Autocomplete Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"datePublished\":\"2017-06-21T13:22:13+00:00\",\"dateModified\":\"2018-01-08T11:12:10+00:00\",\"description\":\"In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bootstrap\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/bootstrap\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Bootstrap Autocomplete Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\",\"name\":\"Siddharth Seth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"caption\":\"Siddharth Seth\"},\"description\":\"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bootstrap Autocomplete Example - Web Code Geeks - 2026","description":"In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/","og_locale":"en_US","og_type":"article","og_title":"Bootstrap Autocomplete Example - Web Code Geeks - 2026","og_description":"In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and","og_url":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-06-21T13:22:13+00:00","article_modified_time":"2018-01-08T11:12:10+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","type":"image\/jpeg"}],"author":"Siddharth Seth","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Siddharth Seth","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/"},"author":{"name":"Siddharth Seth","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592"},"headline":"Bootstrap Autocomplete Example","datePublished":"2017-06-21T13:22:13+00:00","dateModified":"2018-01-08T11:12:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/"},"wordCount":779,"commentCount":2,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","keywords":["bootstrap"],"articleSection":["Bootstrap"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/","url":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/","name":"Bootstrap Autocomplete Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","datePublished":"2017-06-21T13:22:13+00:00","dateModified":"2018-01-08T11:12:10+00:00","description":"In this example we will build a Bootstrap Autocomplete that helps users with suggestions as they fill text fields. Autocomplete reduces keystrokes and","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-autocomplete-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/www.webcodegeeks.com\/category\/css\/"},{"@type":"ListItem","position":3,"name":"Bootstrap","item":"https:\/\/www.webcodegeeks.com\/category\/css\/bootstrap\/"},{"@type":"ListItem","position":4,"name":"Bootstrap Autocomplete Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592","name":"Siddharth Seth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","caption":"Siddharth Seth"},"description":"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/17393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/213"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=17393"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/17393\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/8515"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=17393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=17393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=17393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}