Javascript, jquery error TypeError: $ (...). Autocomplete is not a function

I've looked at questions like the above and none of them helped.

Here are my scripts

<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="network.json"></script>
    <script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
    <link type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/smoothness/jquery-ui.css" rel="stylesheet" />

<body>      
        <link href="ajs_network1.css" rel="stylesheet" type="text/css" />
        <script src="ajs_network1.js" type="text/javascript"></script>

    </body>

      

Here is a function trying to call JQuery

$(function () {
    $("#search").autocomplete({
        source: optArray
    });
});

      

For some reason its error appearing

TypeError: $(...).autocomplete is not a function.

      

I'm guessing I did something wrong with the scripts?

+3


source to share


3 answers


The links were correct, I used. But since I was getting links online, I didn't go into http at the beginning. So now the links will be as follows:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>        
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" /> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>β€Œβ€‹

      



Also, there were hidden characters for some reason when I copied the link, so the link didn't work. When working with this, make sure your browser is receiving links. FireBug will help me with this. Click "net" and it will tell you what scripts the browser is importing.

Thanks everyone that helped :)

-1


source


just by adding this link my problem was resolved.



<script async src="//code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>

      

+5


source


Try adding these links to your code as you are missing these

<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

      

+2


source







All Articles