ClayKaboom ClayKaboom - 3 months ago 12x
jQuery Question

JQuery clean autocomplete combobox value

I used a jquery combobox for autocompletion and I needed to clean its value.
I got into a solution which is like this:

The problem is that the code below clears all textboxes of all combos in the screen. I'd like to clear only ONE combo (let's say the first one, for example).


Although there is only one clear link button, it doesn't matter which combo will be cleared as long as only one is.

The solution should work for N combos in the screen. E.g. Each button should empty its corresponding combo.


You can add ids to the generated fields by adding this line as the last line of _create():

input.attr( 'id', $(select).attr( 'id' )+'-input' );

Now you can select individual fields with the ids: