I am trying to use the jQuery autocomplete
feature on an ASP MVC 3 web page. Unfortunately I keep getting this error. I've looked at version 1.9.2, which I'm using, and it does have the autocomplete method. I am, however, completely new to jQuery and not sure if there are too many declarations in the header, conflicting libraries, or missing ones.
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/
You're using multiple versions of jQuery. Include only one and put it at the top of all the scripts.
Including multiple versions of jQuery does not work because:
jQuery
object.jQuery
object.jQuery
object with its own 1.6.4 jQuery
object, overwriting all the plugins on the old one with it.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With