Tiny JavaScript Plugin For Amazon Autocompletion

Category: Form , Javascript , Recommended | April 4, 2020
Author:caroso1222
Views Total:441 views
Official Page:Go to website
Last Update:April 4, 2020
License:MIT

Preview:

Tiny JavaScript Plugin For Amazon Autocompletion

Description:

A small and easy-to-use JavaScript plugin for Amazon.com autocompletion that uses JSONP to fetch the product data from Amazon.

How to use it:

Copy and include the main JS file into the html page.

<script src="/path/to/amazon-autocomplete.min.js"></script>

Create a text field where you want to apply the Amazon Autocompletion to.

<input type="text" id="search-input">

Enable the Amazon Autocompletion on this text field.

let searchInput = new AmazonAutocomplete('#search-input');

Possible plugin options with default values.

let searchInput = new AmazonAutocomplete({
    selector: '#search-input',
    delay: 150,
    showWords: true,
    hideOnblur: true
});

API events.

// Log the selected word to the console
searchInput.onSelectedWord(word => console.log(`searching for ${word}...`));
// Populate your custom panel whenever there are new suggested words available
searchInput.onNewWords(words => words.forEach(word => addWordToCustomPanel(word)));

Changelog:

v1.0.2 (04/04/2020)

  • Fix FF issue

You Might Be Interested In:


Leave a Reply