Advertisement
Architecte

Autocomplete postalcode

Oct 25th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.40 KB | None | 0 0
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement