My changes rely on jQuery being part of your project.
This is what the initialisation code looks like now. Note that it does not search for any specific input element ID, instead it searches for all input elements that have the CSS class 'loc_autocomplete' and sets them up as an auto-completable field.
In my HTML, I do something like this...
Any input element with the same CSS class will be initialised now.