I’m building a jquery function that pulls from a database in order to allow users to select a location. These locations have two relevant columns: Name, city and ID.
Currently I have it setup so that the autoselection displays Name + City as the text for the user. How do I associate that row’s ID with the text? So that the user can select their location by name and city – but I have the ID of the club they’ve selected in either a hidden field on in the actual tag?
Within the autocomplete plugin there is the ability to pass the custom data which is then stored in the jQuery data object on each element and passed as parameters on various callbacks. You can take a look at this example in the docs, you’ll find what your looking for there.