diff --git a/misc/autocomplete.js b/misc/autocomplete.js
index 5e85be4..58289a6 100644
--- a/misc/autocomplete.js
+++ b/misc/autocomplete.js
@@ -215,7 +215,7 @@ Drupal.jsAC.prototype.found = function (matches) {
   // Prepare matches.
   var ul = $('<ul></ul>');
   var ac = this;
-  for (key in matches) {
+  $.each(matches, function(key, element) {
     $('<li></li>')
       .html($('<div></div>').html(matches[key]))
       .mousedown(function () { ac.select(this); })
@@ -223,7 +223,7 @@ Drupal.jsAC.prototype.found = function (matches) {
       .mouseout(function () { ac.unhighlight(this); })
       .data('autocompleteValue', key)
       .appendTo(ul);
-  }
+  });
 
   // Show popup with matches, if any.
   if (this.popup) {
