Advertisement
Virajsinh

jQuery Autocomplete

Apr 1st, 2024 (edited)
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.60 KB | Source Code | 0 0
  1. $("#business_address").autocomplete({
  2.     source: function(request, response) {
  3.         $.ajax({
  4.             url: "url",
  5.             // dataType: "jsonp",
  6.             data: {
  7.                 term: request.term
  8.             },
  9.             success: function(data) {
  10.                 response(data);
  11.             }
  12.         });
  13.     },
  14.     minLength: 3,
  15.     select: function(event, ui) {
  16.         // console.log(ui.item ?
  17.         //     "Selected: " + ui.item.label :
  18.         //     "Nothing selected, input was " + this.value);
  19.     },
  20.     open: function() {
  21.         $(this).removeClass("ui-corner-all").addClass("ui-corner-top");
  22.     },
  23.     close: function() {
  24.         $(this).removeClass("ui-corner-top").addClass("ui-corner-all");
  25.     }
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement