Implementing simple jQuery autocomplete in plugin

Hi all,

I'm having trouble figuring out the easiest way to implement a jQuery feature on an element text input field (from the Edit or Add Item admin screen). I'm really just trying to replicate the type of autocomplete used in the LC Suggest plugin, but I have no need for a customizable admin panel, the ability to change which element the autocomplete works with, or even the ability to configure which API to use (maybe I'm undemocratic though...)

I've been working on a plugin that introduces a new set of elements to collect geospatial data in accordance with the GeoBlacklight schema, and I would like a particular field to have an autocomplete (with drop down options) function, which queries against placenames from the Geonames API. I'm planning on just using this implementation of it: http://tompi.github.io/jeoquery/

I can get this to work by editing the /admin/themes/default/items/edit.php file, adding the link to the necessary JS script as well as a bit of JS to call the lookup function on the text input field that I want to use this on. That works perfectly, but seems inefficient, and (worse) if I understand correctly it is not something that I could inject through a plugin?

Would the admin_head hook be a better way to accomplish this? I started playing around with that, but haven't been able to inject anything as far as I can tell.

-stephen

You are right that the admin_head hook in a plugin would be the better approach, and should work. Generally, that hook calls the queue_js_file or queue_js_string functions to add the javascript.

Perfect, thanks so much.