jquery ui autocomplete events

Hi experts,

I’m using the jQuery UI Autocomplete.

My example works similar to the custom data and display example found here:

https://jqueryui.com/autocomplete/#custom-data


So this is my fiddle for my example

http://jsfiddle.net/ps0L0znf/

When you run it on my page I have a textbox and a button.

The button called Button1 is disabled on page load. Also a label called LabelYouSelected is hidden

It looks like this:

on page run
After I select an item from the autocomplete. The button is enabled and the label is unhidden.

So after I make a selection then my page looks like this:
after I make a selection

After I make a select , for example if I select Davolio. Davolio is placed inside the autocomplete textbox.

Is there a way that after I select an item and then i clear out Davolio from the textbox to disable the button and hide the label and clear the values on these divs. <div id="LabelEmployeeID"> <div id="LabelLastName"> <div id="LabelFirstName">

Basically If I delete the text from the textbox. I want everything to be just as it is on page load.

anyone know the event when the text gets cleared out from the textbox?
LVL 1
maqskywalkerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
try add:

$("#TextBox1").blur(function() {
              	if ($("#TextBox1").val()=="") {
                    $('#Button1').prop('disabled', true);
                    $("#LabelYouSelected").hide();
                    $("#LabelEmployeeID").html("");
                    $("#LabelFirstName").html("");
                    $("#LabelLastName").html("");
                }    
            });

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.