get jquery ui autocomplete selected id and save in hidden field then display on page on button click

maqskywalker
maqskywalker used Ask the Experts™
on
I have this jquery  UI autocomplete.
http://jsfiddle.net/DLLVw/

Is there a way to get the selected id from the autocomplete but don't display it on select event.

Instead show the selected value when I click the button.

So for example if I pick Algeria from the autocomplete. It will display Algeria in the textbox and the id 18 in another textbox.

Is it possible to save the selected id in a hidden field and then when I click the button display the value that was stored in hidden field on the page?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Awarded 2012
Commented:
Hi,

please check the forked code here:
http://jsfiddle.net/EE_RainerJ/cj6ey54e/

I added this into the onchange:
else {
            	$('#HiddenID').val(ui.item.id);
            }

Open in new window

and added the ShowID function.

HTH
Rainer

Author

Commented:
Thanks. Great example

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial