NS-Lib

Autocomplete


Autocomplete lets you add autofilled suggestions to an <input> textbox. Check it out:





Usage


Using autocomplete boxes is pretty simple. You will want to create a textbox that is wrapped inside a div that has position: relative.

<div style="position: relative">
    <input type="text" id="example-box-1" class="form-control" placeholder="Day of Week" />
</div>

Next, run the Autocomplete.Init function with a reference to your textbox object and an array of options.

NSLib.Autocomplete.Init(
    document.getElementById("example-box-1"),
    ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
);

Here's the result:







On this page