1

I am using jQuery auto complete to filter a list. On select it display one particular item and hides others

Now i want to add a cross icon to remove this selection, when click on it the input box will be reset and a java script function will be called.

enter image description here

 $( "#name_input" ).autocomplete({

                source: availableTags,
                select: function (event, ui) {



                    var selectedObj = ui.item;                
                    filterByName(selectedObj.value);
                    //console.log(selectedObj.value);
                }

            });

How can i add the cross button on input?

4
  • any script written? If means share that too. Commented Jan 31, 2014 at 7:02
  • I am not able to figure out which event will be triggered when select all the input text and remove it. Commented Jan 31, 2014 at 7:03
  • If you just want to reset the input, how about a button with a click-event that sets the value of the input to an empty string? Or what exactly do you want to do? Commented Jan 31, 2014 at 7:12
  • Button will be enough, but i want to show it as cross icon on input field. Commented Jan 31, 2014 at 7:14

1 Answer 1

2

Hey hi Hemc, I hope i understood your problem, you should try out chosen jquery.Chosen git hub

I hope this would solve your problem.

Buddy i found a solution for you go to this link (xoxco.com/projects/code/tagsinput) – Vikarn Singh Mankotia

Sign up to request clarification or add additional context in comments.

4 Comments

yeah, something like it but i cann't use select box. I want same option in auto complete box.
Buddy i found a solution for you go to this link (xoxco.com/projects/code/tagsinput)
go to the demo of this link and see your auto complete section.
Thanks, Got it, i will modify it get desired result.Can you please update your comment in your answer ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.