Uncaught TypeError: Object [object Object] does not have an 'autocomplete' method

I am trying to use the jQuery function autocompleteon an ASP MVC 3 webpage. Unfortunately, I keep getting this error. I looked at version 1.9.2, which I use, and it has an autocomplete method. I am, however, completely new to jQuery and not sure if there are too many ads in the title, conflicting libraries, or missing.

Below is the code from the view

<link href="../../Content/jquery-ui-1.9.2.custom.css" rel="stylesheet">

<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.tablesorter.min.js")" type="text/javascript"></script>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.js"></script>
<script type="text/javascript">

    $(document).ready( function() {
      $('#BankName').autocomplete('@Url.Action("GetBanks", "AgentTransmission")', {
          dataType: 'json',
          parse: function(data) {
              var rows = new Array();
              for(var i=0; i<data.length; i++){
                  rows[i] = { data:data[i], value:data[i].SignalName, result:data[i].SignalName };
              }
              return rows;
          },
          formatItem: function(row, i, n) {
              return row.SignalName + ' - ' + row.Description;
          },
          width: 300,
          mustMatch: true,
      });
    });

Full html can be found here: http://jsfiddle.net/qpvBv/

+5
source share
4 answers

You are using several versions of jQuery. Include only one and place it at the beginning of all scripts.

jQuery , :

  • jQuery 1.8.3. (ish).
  • jQuery UI 1.9.2. , , jQuery jQuery UI . jQuery UI 1.9.2 1.8.3 jQuery.
  • , 1.8.3 jQuery.
  • jQuery 1.6.4. , , 1.8.3 jQuery 1.6.4 jQuery , .
+9

, , jQuery , icktoofay.

, . , , , , , ( "JQUERY INCLUDED" ); .

, , , , , . ajax, . , - .

0

icktoofay, , , :

  <script src="~/fullcalendar/fullcalendar.min.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>

, . , icktoofay , , , . ....

0

gem 'jquery-ui-rails'

application.js

//= require jquery.ui.all
-2
source

All Articles