Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object doesn't support property or method 'autocomplete'

Tags:

jquery

I am getting this error after adding some autocomplete code. I am sure it has something to do with duplicate jQuery references after searching online but I have it referenced only once.

The application uses a master page but the page in question doesn't use it so I have jquery referenced in both.

$(".autosuggest").autocomplete({
  source: function(request, response) {
    $.ajax({
      type: "POST",
      contentType: "application/json; charset=utf-8",
      url: "CustomerTypes.aspx/GetAutoCompleteData",
      data: "{'Customer':'" + document.getElementById('txtCustomerType').value + "'}",
      dataType: "json",
      success: function(data) {
        response(data.d);
      },
      error: function(result) {
        alert("Error");
      }
    });
  }
});
like image 615
connersz Avatar asked Feb 28 '26 09:02

connersz


1 Answers

autocomplete() is a method in the jQueryUI library. You need to add a reference to that as well as jQuery.js:

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
like image 86
Rory McCrossan Avatar answered Mar 01 '26 23:03

Rory McCrossan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!