jquery autocomplete on button click get hidden value

Posted by gabriel on Stack Overflow See other posts from Stack Overflow or by gabriel
Published on 2010-06-16T07:53:06Z Indexed on 2010/06/16 8:02 UTC
Read the original article Hit count: 250

Filed under:
|

using jquery autocomplete, we get hidden value by calling .result function like this

$("#suggest").result(function(event, data, formatted) {
   $('#hidden').val(data[1]);
 });

This is only useful when we selected the option from autosuggest list and press enter. What i need is that i enter the option by typing the complete word without selecting it and clicking on Ok button? but i am always getting empty.

<input type="text" id="suggest" />
<input type="button" value="Ok" onclick="GetValue()" />
<input type="hidden" id="hidden"/>
function GetValue()
{
   //get hidden field value - getting empty
  var hid=document.getElementById('hidden').value;
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about autocomplete