jQuery Auto Complete

I have a jQuery autocomplete function on my website, which works for the most part.  If you type more than 2 letters or numbers, it will return the results.  If I use the up and down arrow keys to highlight the results, the input box (#search) will change it's value to the selected text.  If I use the mouse to click on a result, it gets highlighted, but the value of #search never changes.

here's my code:

$( "#search" ).autocomplete({
			source: "showsearchresults_home.asp",
			minLength:2,
			select: function( event, ui ) {
				log( ui.item ?
					"Selected: " + ui.item.value + " aka " + ui.item.id :
					"Nothing selected, input was " + this.value );
			}
			});
		});

Open in new window


And the HTML for the search box:

<form name="search_form" id="searchbox" action="#" method="get">
                    	<input id="search" type="text" name="search" />
                        <input id="submit_top" type="submit" value="Search" onclick="this.submit"/>
                    </form>

Open in new window


Any ideas on what I might be doing wrong?

Thank you for your help!!!
LVL 1
slightlyoffAsked:
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.

leakim971PluritechnicianCommented:
out of the code you post you've a event.preventDefault() or similar on a click event : Remove it
0
Julian HansenCommented:
Can you post a link or full source for the page.
0
Chris StanyonWebDevCommented:
You need to explicitly set it within your 'select' function:

$( "#search" ).autocomplete({
	source: "showsearchresults_home.asp",
	minLength:2,
	select: function( event, ui ) {
		$(this).val(ui.item.value); //set the value of the search field
		log( ui.item ?
			"Selected: " + ui.item.value + " aka " + ui.item.id :
			"Nothing selected, input was " + this.value );
	}
});

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
slightlyoffAuthor Commented:
Thank you!  That was what I needed :)
0
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.