diff options
Diffstat (limited to 'misc/autocomplete.js')
-rw-r--r-- | misc/autocomplete.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/misc/autocomplete.js b/misc/autocomplete.js index 6efcf1e26..da76380c4 100644 --- a/misc/autocomplete.js +++ b/misc/autocomplete.js @@ -3,19 +3,21 @@ /** * Attaches the autocomplete behavior to all required fields. */ -Drupal.behaviors.autocomplete = function (context) { - var acdb = []; - $('input.autocomplete:not(.autocomplete-processed)', context).each(function () { - var uri = this.value; - if (!acdb[uri]) { - acdb[uri] = new Drupal.ACDB(uri); - } - var input = $('#' + this.id.substr(0, this.id.length - 13)) - .attr('autocomplete', 'OFF')[0]; - $(input.form).submit(Drupal.autocompleteSubmit); - new Drupal.jsAC(input, acdb[uri]); - $(this).addClass('autocomplete-processed'); - }); +Drupal.behaviors.autocomplete = { + attach: function(context) { + var acdb = []; + $('input.autocomplete:not(.autocomplete-processed)', context).each(function () { + var uri = this.value; + if (!acdb[uri]) { + acdb[uri] = new Drupal.ACDB(uri); + } + var input = $('#' + this.id.substr(0, this.id.length - 13)) + .attr('autocomplete', 'OFF')[0]; + $(input.form).submit(Drupal.autocompleteSubmit); + new Drupal.jsAC(input, acdb[uri]); + $(this).addClass('autocomplete-processed'); + }); + } }; /** |