Try it out

Type your query into the box below (it searches for fruits and vegetables).

What is it?

Smart Suggest is a "fancy" search suggestion plugin for jQuery. Smart Suggest takes auto-complete boxes to the next level.

How to use

1. Copy files

Copy the following files and directories from the code directory of the ZIP to your project directory:

2. Link to the JavaScript and CSS

You need to link to both the jQuery library and the files you just copied:

<link rel="stylesheet" type="text/css" href="css/smartSuggest.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
<script type="text/javascript" src="js/smartSuggest.js">

3. Add the JavaScript code

Now you need to tell the plugin which input field(s) you'd like to convert to Smart Suggest boxes. Assuming your input field has an ID of field:

$(document).ready(function() {
  $('#field').smartSuggest({
    src: 'DATA SOURCE URL HERE'
  });
});

4. Create your JSON output source

[
  # Add below block for each category
  {
    header: {
      title: "Category Title",
      num: "Number of results",
      limit: "Number to display"
    },
    data: [
      # Add below block for each result
      {
        primary: "Title",
        secondary: "Description (Optional)",
        image: "URL (Optional)",
        onclick: "JavaScript to execute when clicked (Optional)"
      }
    ]
  }
]

Configuration options

Parameters

The following parameters can be included in the Smart Suggest call. Show code for an example.

Other notes

Examples

Single category


Show code

Multiple categories


Show code

Auto-complete fill style


Show code

No images


Show code

Questions? Suggestions?

Visit JamesSkidmore.com to get in touch.

To download this script, please visit this link.