Hints - small javascript library to provide autocompletion help

Features

Demos

Simple hint list

Perfect to hint always the same items, independent of user input.

new Hints('#demo-simple', {
    hints:  ['ä', 'ö', 'ü', 'ß']
});
Text input with hints for german letters "ä", "ö", "ü", "ß".

Different hints for different triggers

Useful when only some hints should be displayed depending on user input.

new Hints('#demo-triggers', {
    behavior: 'replace',
    hints: {
        'B': ['Baden-Württemberg', 'Bayern', 'Berlin', 'Brandenburg', 'Bremen'],
        'H': ['Hamburg', 'Hessen'],
        'M': ['Mecklenburg-Vorpommern'],
        'N': ['Niedersachsen', 'Nordrhein-Westfalen'],
        'R': ['Rheinland-Pfalz'],
        'S': ['Saarland', 'Sachsen', 'Sachsen-Anhalt', 'Schleswig-Holstein'],
        'T': ['Thüringen']
    }
});
Text input with different hints depending on input value.

Inline autocomplete

When you want to append hint value to the input.

new Hints('#demo-inline-autocomplete', {
    behavior: 'replace',
    hints: {
        'B': ['Baden-Württemberg', 'Bayern', 'Berlin', 'Brandenburg', 'Bremen'],
        'H': ['Hamburg', 'Hessen'],
        'M': ['Mecklenburg-Vorpommern'],
        'N': ['Niedersachsen', 'Nordrhein-Westfalen'],
        'R': ['Rheinland-Pfalz'],
        'S': ['Saarland', 'Sachsen', 'Sachsen-Anhalt', 'Schleswig-Holstein'],
        'T': ['Thüringen']
    },
    inlineAutocomplete: true,
});
Text input with different hints depending on input and inline autocomplete.

Add & Remove

Update your hint list whenever you need it.

new Hints('#demo-add-remove');
Text input with different hints depending on input and inline autocomplete.

Getting started

  1. Setup your HTML.

    <input id="demo"/>
  2. Add hints.css in your head.

    <link rel="stylesheet" href="hints.css">
  3. Add hints.js before your closing body tag.

    <script src="hints.js"></script>
  4. Initialize hints.

    new Hints('#demo');

Settings

Events

Methods

Get it now

You will find all the code on Github.