Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear autocomplete selected values?

I have a page with several JQuery autocompletes. I have implemented a button to clear all selected values, but it does not work... I have tried to set $(...).text(""); but it does not work. Firebugs fails on the line and does not throw any error message. It quits the function.

What is the right way to clear the selected value of JQuery autocompletes, from code?

like image 966
Jérôme Verstrynge Avatar asked Jan 15 '12 04:01

Jérôme Verstrynge


2 Answers

You should use:

$('selector').autocomplete('close').val('');

This will also reset the current search of the autocomplete (in addition to clearing the input).

like image 113
yarg Avatar answered Nov 15 '22 05:11

yarg


Try using $(...).attr("value","");

Hope it works!! Sorry if i have misunderstood the question.

like image 27
Hemesh Singh Avatar answered Nov 15 '22 05:11

Hemesh Singh