autocomplete “is not a function”

前端 未结 5 1495
攒了一身酷
攒了一身酷 2021-02-19 06:45

We\'ve tested the Jquery UI (jquery-ui-1.8.10.custom.min.js) Autocomplete function in a simple HTML page which worked.

We then copy the same code into an Asp.net User C

相关标签:
5条回答
  • 2021-02-19 06:58

    That error usually means that jquery or the plugin hasn't yet been loaded. Check that you're function call isn't getting hit before the document is loaded:

    $(function(){
        var $searchBox = $('#mysearchBox');
        $searchBox.autocomplete(...);
    });
    

    Also check that the path to the javascript files are correct. Firebug or google chrome developer tools are useful for checking both of these issues.

    0 讨论(0)
  • 2021-02-19 07:05

    Maybe try using the jQuery.noConflict() method for a test. It basically just makes you use a different alias for jQuery. This worked for me in SF4.3.

    var j = jQuery.noConflict();
    // Do something with jQuery
    j("div p").hide();
    // Do something with another library's $()
    $("content").style.display = 'none';
    
    0 讨论(0)
  • 2021-02-19 07:09

    This is caused by a conflict with Sitefinity's own use of jQuery.

    If you move your script references for jQuery to the bottom of the page before the closing form tag. This will resolve the issue in Sitefinity 4.0, but I suspect it will also fix this problem in Sitefinity 3.7.

    0 讨论(0)
  • 2021-02-19 07:15

    It could be:

    1. The order that jquery.js get loaded.
    2. Duplicate jquery.js includes in the same page.
    0 讨论(0)
  • 2021-02-19 07:17

    I had this issue and what was happening was my jQuery file was loading twice. Pretty much this was in my head:

    <script src="assets/js/jquery.min.js"></script>
    <script src="js_css/jquery-ui.min.js" ></script>
    

    And then I had an AJAX call that loads more parts of my document and there was another:

    <script src="assets/js/jquery.min.js"></script>
    

    script tag in my AJAX results and I was $.hmtl() my results to my document. By doing this we are pretty much redefining all of the var thatjquery-ui.min.js altered or took advantage of.

    0 讨论(0)
提交回复
热议问题