below is my My Code
You are calling the function before the page loads jQuery. It is always advisable to use jQuery inside
$(document).ready(function(){ //Your code here });
In your case:
$(document).ready(function(){
$(function(){
$( "#searcharea" ).autocomplete({
source: "suggestions.php"
});
$( "#searchcat" ).autocomplete({
source: "suggestions1.php"
});
});
});
Check the Sources-> Scripts in browser Inspect tool. Sometimes multiple jQuery files can be referring. In ASP.NET MVC, this usually happens when the layout page already has a jQuery reference.
Possibly multiple jquery.js file are added in , and the conflict appeared.
I faced the same problem and try to solve, but unfortunately it wouldn't work anymore ! If you are facing the same problem and can't find the solution, it may help you.
If you configure jquery/jquery-ui globally in webpack, you need to import autocomplete like this
import { autocomplete } from 'webpack-jquery-ui';
And you must include jquery-ui.css in the head section of html, i don't understand why its not working without it!
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
Hope your problem will be solved.
And make sure you include/install the following three
Loading jQuery library before Angularjs library helped me.
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
For my case, my another team member included another version of jquery.js when he add in bootstrap.min.js. After remove the extra jquery.js, the problem is solved