🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

code42day-autosuggest

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code42day-autosuggest

Autosuggest values for text inputs

1.0.0
latest
Source
npm
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

autosuggest

Autosuggest values for text inputs

<input type="text"> autosuggest component. Try the demo!

Inspired from http://oak.cs.ucla.edu/cs144/projects/javascript/suggest1.html.

Installation

$ component install component/autosuggest

Example

var autosuggest = require('autosuggest');
var input = document.querySelector('input[type="text"]');

// array of suggestions
var suggestions = [
  'Sunday',
  'Monday',
  'Tuesday',
  'Wednesday',
  'Thursday',
  'Friday',
  'Saturday'
];

// create an `autosuggest` instance
var suggest = autosuggest(input, suggestions);

// and you can change the array of suggestions to use if they get change
var newSuggestions = suggestions.concat([ 'Funday' ]);
suggest.set(newSuggestions);

API

autosuggest(el, [suggestions]) → Autosuggest

Returns an Autosuggest instance. The instance has .start() called on it if the optional suggestions array is given, otherwise you must call .set(array) and .start() manually.

.set(array)

Sets a new array of Strings to use as the suggestions for the Autosuggest instance.

.start()

Starts the autosuggesting for the Autosuggest instance.

.stop()

Stops the autosuggesting for the Autosuggest instance..

License

MIT

Keywords

browser

FAQs

Package last updated on 22 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts