wuyuntao / jquery-autosuggest

A fork of AutoSuggest jQuery plugin writtern by Drew Wilson.
http://github.com/wuyuntao/jquery-autosuggest
118 stars 59 forks source link

Clearing of input field when adding items with javascript callback #19

Open villejj opened 12 years ago

villejj commented 12 years ago

It would be nice if the component would clear the input field when adding items with the javascript callback.

My current workaround is to "manually" clear the input after calling the "add" method.

var autoSuggest = $(autosuggestFieldId); options.start = function(callbacks){ addItem = callbacks.add; }; autoSuggest.autoSuggest(..., options); ... addItem(item); autoSuggest.val('');

Btw, using the callbacks for adding items might be something to be added to documentation, took a while to figure out how it works.