I
I found your autocomplete function and it is about as simple and complete than I've seen
I tried to installed it in the rails asset pipe line. I did convert it to coffee script, but I had to hack it get it running on a test page
Just adding at the end of the page were I was going to test it didn't work.
autocomplete(document.getElementById("myInput"), countries);
It ruturned couldn't find autocomple
The hack was to put autocomplete in the pipeline under jquery
jQuery ->
$("#startem").on "load", ->
inp = document.getElementById("myInput")
autocomplete(inp,entries)
autocomplete = (inp, arr) -> .....
Then put on the test page
#startem
javascript:
$(function() {
$('#startem').trigger('load');
});
The hack works, but I'm sure there is a better way. My Javascript knowledge if not that great.
Since it looks fairly reusable (I may have a few places I'd like to use it) I'm looking for suggestions on a corrent way.
Steve