[url]http://www.webreference.com/programming/javascript/ncz/column3/
I recently implemented the code from the above Tutorial, to implement “autocomplete” functionality on a field on my web-page. All is well, except now I need to have it work on 3 fields on my web-page, and I’m not experienced enough with JS to know how to create multiple instances.
Looking through the code, I see that the text input field (txt1) gets the functionality via this code on page-load:
var oTextbox = new AutoSuggestControl(document.getElementById(“txt1”), new StateSuggestions());
so then I looked through the JS and I see that oTextbox gets used in 2 places. You can see where by looking at the JS at : [url]http://www.webreference.com/programming/javascript/ncz/column3/autosuggest2.js
And that’s where I get lost – – – in the world of JS private class scoping and prototypes. If someone could show me how I could do autocomplete on more than 1 field on a page at a time, I’d greatly appreciate it. What I’ll need to have happen is to have field A autocomplete with one set of suggestions, and field B autocomplete with another set.
Unfortunately, I am unable to email the author (his site keeps saying my messages are spam ?