I'm using Jörn's autocomplete plugin and I'm having trouble changing
the value of my hidden input. The first part works fine - it searches
the array and I can select select any of the results. However, I'm
trying to grab the "id" key value from the array and use it as the
value of my hidden input (name="account").

Here's my test page:
http://www.viktorwithak.com/Test/AutoComplete/index.htm
(I'm using a "GET" form, so submit the form and you'll see that the
"account" value is currently empty)

Here's my array:
var accounts = [
        { name: "Account One", id: "0001" },
        { name: "Account Two", id: "0002" },
        (etc...)
];

...and the part that (I believe) should be putting the value of
#account into my hidden input.
$("#account").result(function(event, data, formatted) {
        if (data)
                $(this).parent().next().find("input").val(data[1]);
});

Seems like it should be a relatively simple solution, but I'm still
new to JS and jQuery. Any help is appreciated. Thanks!

Reply via email to