Question

My jQuery Autocomplete works fine with jQuery version 1.9 but when I'm using jQuery v1.8.3 then it shows me error:

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

I can not change my jQuery version from v1.8.3 to 1.9 due to other functions also disturbs. How can I use the jQuery autocomplete with this jQuery v1.8.3 version? I'm talkin about this Autocomplete.

Here is my code:

<script src="<?php bloginfo('template_url');?>/library/js/jquery_1.9.js"></script>
<script src="<?php bloginfo('template_url');?>/js/UI/ui/jquery-ui.js"></script>
<link rel="stylesheet" href="<?php bloginfo('template_url');?>/js/UI/themes/base/jquery-ui.css">


function autoComplete(obj)
{
    var term_val = obj.value
    var findin   = "";
    if(term_val == "")
    {
        console.log(term_val);
        $("#"+obj.id).val("");
        $("#ui-id-1").remove();
    }
    else
    {
        $.ajax({
              type:"POST",
              url:"<?php echo bloginfo('template_url')?>/ajax.php", data:"&term_val=" + term_val,
              dataType:"json",
              success:function (data) {
              var availableTags = data;

                  $( "#"+obj.id ).autocomplete({
                      minLength: 0,
                      source: availableTags
                  });
              }
          });


    }

}


<input type="text" name = "quick_search_new" id="quick_search_new" onkeyup="autoComplete(this)" autocomplete="off"/>

when I use the above jQuery file with the 1.8 version its not working showing me error:

<script src="<?php bloginfo('template_url');?>/library/js/jquery_1.8.js"></script>
    <script src="<?php bloginfo('template_url');?>/js/UI/ui/jquery-ui.js"></script>
    <link rel="stylesheet" href="<?php bloginfo('template_url');?>/js/UI/themes/base/jquery-ui.css">
Was it helpful?

Solution

I solve my problem by changing my Jquery Ui version From jQuery UI - v1.10 to jQuery UI - v1.8.24. And its working fine. Thanks all

<script src="<?php bloginfo('template_url');?>/js/UI/ui/jquery-ui.js"></script> <!-- Version  v1.10 -->

Replaced with

<script src="<?php bloginfo('template_url');?>/js/UI/ui/jquery-ui.js"></script> <!-- Version  v1.8.24 -->

Now its Working Fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top