Want more features on Pastebin? Sign Up, it's FREE!
Guest

Autocomplete postalcode

By: Architecte on Oct 25th, 2011  |  syntax: jQuery  |  size: 0.40 KB  |  views: 70  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $('#codepostal').autocomplete({
  2.     source: postalcodes,
  3.     minLength: 2,
  4.     focus: function(event, ui) {
  5.         $(this).val(ui.item.value);
  6.  
  7.         return false;
  8.     }
  9. })
  10.     .data("autocomplete")._renderItem = function(ul, item) {
  11.     return $("<li></li>")
  12.         .data("item.autocomplete", item)
  13.         .append("<a>" + item.value + " - " + item.label + "</a>")
  14.         .appendTo(ul);
  15. };
  16.  
clone this paste RAW Paste Data