JavaScript-autoComplete is an extremely lightweight and powerful vanilla JavaScript completion suggester. Developed by Pixabay.com, it provides flexible data sourcing, smart caching, and callback functionalities with no external dependencies. The library is very small, weighing in at less than 2.4 kB gzipped. It was last updated in 2016, with its current stable version being 1.0.5. Given its age and lack of recent development, it operates on a very slow release cadence and is primarily intended for environments where a minimal, standalone JavaScript solution is preferred over modern, framework-integrated alternatives. Key differentiators include its zero-dependency nature and extreme lightness, making it suitable for legacy projects or very simple, performance-critical contexts where a full-featured library would be overkill.
npm install javascript-autocompleteVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `AutoComplete` library on an input field using a static array as the data source and logs the selected item to the console.
Consider migrating to a modern, actively maintained autocomplete library (e.g., Algolia Autocomplete, Headless UI Combobox, or a framework-specific solution) for security, compatibility, and feature updates.
Ensure your bundler is configured to correctly import CommonJS/UMD modules. Alternatively, use it as a global script for simpler setups. For TypeScript, manual declaration files (`.d.ts`) would be required.
Create a `declarations.d.ts` file in your project: `declare class AutoComplete { constructor(options: any); }` and define types for the options object as needed.Ensure the `<script src="..."></script>` tag for `auto-complete.min.js` is placed in the HTML document before any script that attempts to use the `AutoComplete` constructor, typically at the end of the `<body>`. Verify the script path is correct and accessible.
Verify that the `selector` (e.g., `'#search-field'`) accurately targets an existing HTML input element. Ensure that the `new AutoComplete()` call is deferred until the DOM is fully loaded, typically by placing the script at the end of `<body>` or wrapping it in a `DOMContentLoaded` event listener.
No dependency data recorded yet.