Pages UI
v5.0.1 - Pages HTML
v5.0.1 - Pages HTML
  • Getting Started
  • Introduction
    • Layouts
    • Themes
    • Sass
    • Content
  • Apps
    • Calendar
    • Social
    • Email
  • API Reference
  • UI Elements
    • Color
    • Typopgrahy
    • Icons
    • Buttons
    • Notifications
    • Modals
    • Progressbar
    • Collapse
    • Tabs
    • Sliders
    • Treeview
    • Nestable
  • Form Elements
    • Checkboxes and Radio
    • Toggle
    • Typehead
    • Selectbox
    • Datepicker
    • Masked Input
    • Autonumeric
    • Quill Editor
    • Tags Input
    • File Upload
  • Form Layouts
  • Form Validation
  • Form Wizard
  • Charts
  • Maps
    • Google Maps
    • Vector Maps
  • Tables
  • Cards
  • Timeline
  • Views
  • Grid
  • Helpers
  • Troubleshooting
  • Browser Support
  • Change log
  • Legacy Docs
  • Other
    • Grunt
    • Gulp
    • Rails
Powered by GitBook
On this page
  1. Form Elements

Typehead

PreviousToggleNextSelectbox

Last updated 6 years ago

These are also know as auto-fill input boxes that fills up while you type. This is powered by Bootstrap type-head.

You can view there official documentation

Step One

Include the required javascript files inside the <body> before core template script inclusions, if they are not there already.

<script src="assets/plugins/bootstrap-typehead/typeahead.bundle.min.js"></script>
<script src="assets/plugins/bootstrap-typehead/typeahead.jquery.min.js"></script>

Step Two

Create a simple text box field and give it an ID so you can initialize in your JS file

<div class="form-group">
<input class="typeahead form-control" id="mytyphead" type="text" placeholder="States of USA">
</div>

<form class="" role="form">
<div class="form-group form-group-default required typehead" id="sample-three">
<label>Countries</label>
<input class="typeahead form-control" id="mytyphead" type="text" placeholder="States of USA">
</div>
</form>

Step Three

Initialize your typehead with the ID you use

        var countries = new Bloodhound({
          datumTokenizer: Bloodhound.tokenizers.whitespace,
          queryTokenizer: Bloodhound.tokenizers.whitespace,
          prefetch: 'http://pages.revox.io/json/countries-list.json'
        });

        // passing in `null` for the `options` arguments will result in the default
        // options being used
        $('#mytyphead').typeahead(null, {
          name: 'countries',
          source: countries
        });
here