Cookie Based Input History Plugin For jQuery - searchHistory.js

File Size: 5.89 KB
Views Total: 6581
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Cookie Based Input History Plugin For jQuery - searchHistory.js

searchHistory.js is a jQuery plugin which stores previously entered input values in local cookies and displays them in a dropdown suggestion list as you type something in a text input (typically search input). Compatible with ArtemFitiskin's Autocompleter plugin.

See also:

How to use it:

1. Include the needed jQuery library and jQuery cookie plugin on your webpage.

<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/jquery.cookie.min.js"></script>

2. Download the plugin and then include the jquery.searchHistory.js script after jQuery.

<script src="jquery.searchHistory.js"></script>
<link type="text/css" rel="stylesheet" href="jquery.searchHistory.css">

3. Just call the function on your form and the plugin will take care of the rest.

$('#YOUR-FORM').searchHistory();

4. Possible plugin options with default values.

$('#YOUR-FORM').searchHistory({
  maxShowNum: 4, // max entries
  expires: 7, // 7 days
  input: '.history-input',
  cookieName: 'searchHistory',
  selected: function () { },
  beforeSend: function () { return true; },
  sendWhenSelect: true,
  actionByCall:false
});

This awesome jQuery plugin is developed by helloxiyue. For more Advanced Usages, please check the demo page or visit the official website.