I am trying to format the jqueryui autocomplete dropdown menu and currently have a list of states and cities in the dropdown menu, like so:
  Boston Massachusetts
  Seattle Washington
  Atlanta Georgia
  Waco Texas
  Walla Walla Washington
I would like to line them so that the states line up:
  Boston       Massachusetts
  Seattle      Washington
  Atlanta      Georgia
  Waco         Texas
  Walla Walla  Washington
How do I do that? Solely calculating the number of characters in the cities and then adding a "filler" to those cities that have fewer characters doesn't work as it doesn't take into account kerning and different character widths (ie "W" vs. "i").
I've tried monkeypatching, as described here, and tried formatting the dropdown box as a table, with each city and state in their own columns. However, the table elements get no respect from JQuery UI and doesn't change the formatting.
Any suggestions?
function monkeyPatchAutocomplete() {
          $.ui.autocomplete.prototype._renderItem = function( ul, item) {
              var re = new RegExp(this.term, "i");
              var l = item.label.replace(re,"<span style='font-weight:bold;color:#000;'>" + "$&" + "</span>");
              var v = item.value.replace(re,"<span style='font-weight:bold;color:#000;'>" + "$&" + "</span>");
              return $( "<li></li>" )
                  .data( "item.autocomplete", item )
                  .append( "<a>" + v + " " + l + "</a>" )
                  .appendTo( ul );
          };
      }