Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
component.css
component.js
component.json
dependencies.html
example.html
picture.jpg
readme.md

readme.md

j-AutoComplete

  • easy usage
  • works with <input tags only
  • singleton
  • NEW: works with contenteditable attribute
var opt = {};

opt.element = 'YOUR_ELEMENT';

opt.search = function(query, render) {
	// `query` contains a value from the input
	// `render` is a function
	// Here we have to find a datasource and render argument helps with rendering HTML

	AJAX('GET /cities/', { q: query }, render);

	// or e.g.
	// render([{ name: 'Item 1', type: 'Pages' }, { name: 'Item 2', type: 'Widgets' }]);
};

opt.callback = function(value, input) {
	console.log('---> selected value:', value);
	// input.val('');
};
// opt.callback {Function}
// OR:
// opt.path {String} a path to variable (for result)

// opf.offsetWidth {Number} "width" offset
// opt.offsetX {Number} "x" offset
// opt.offsetX {Number} "y" offset

SETTER('autocomplete', 'show', opt);

Author

You can’t perform that action at this time.