I have a function that works in my JQuery autocomplete.
The function itself seems to work, but when selecting from autocomplete list, the line to empty the input is not working.
I re-created the issue here:
http://jsfiddle.net/bv8nr2gp/1/
Everything works, except the line $('#' + x).val('');
UPDATE
I've updated the fiddle to include the missing elements.
If you enter a value in the input field and click Add it works. The value is added to the textarea and span and then removed from the input.
If you enter "one" or "two" in the input and choose it from the autocomplete list, it works apart from clearing the input
_displayand_addseems to be missing in your jsfiddle. Please include those and explain in detail how we can test that it's not working