I am using jquery autocomplete (1.8) to fill tags just like explained in http://net.tutsplus.com/tutorials/javascript-ajax/how-to-use-the-jquery-ui-autocomplete-widget/.
What i need is after selection of LI item from drop down menu, that item should be removed from list.
In select section of autocomplete I tried to get current LI using diff method like
$(this).get(0).tagname //which return undefined
e.target.id //which return id of textfield to which autocomplete is bound
Assuming you are doing exactly as in the tutorial you linked to:
var ignored=[];). You could put it in the global scope to ensure it will be accessible anywhere (put before$(function() { ...).On the definition of the
sourcecallback (which formats the results), replace thiswith this:
Then, inside the
selectcallback, add the selected item’s value to theignoredarray:You’ll probably want to ‘un-ignore’ the item if the user clicks on a remove link. Inside the remove handler definition, on the first line, add this: