Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery autocomplete custom data error no such method 'instance' for autocomplete widget instance

I am adding the autocomplete functionality to text box. Referring this jQuery autocomplete custom data plugin.

Without custom data code it is working fine. I have added following custom data code

 .autocomplete( "instance" )._renderItem = function( ul, item ) {
                        return $( "<li>" )
                          .append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
                          .appendTo( ul );
                      };

it throws error as

no such method 'instance' for autocomplete widget instance

is there anything that I am missing.

I am using jQuery v1.11.2 and jQuery UI - v1.10.3

like image 389
Anuja Patil Avatar asked May 21 '15 06:05

Anuja Patil


1 Answers

Updated the syntax for the new version: I think they are not using instance now.

       $("#Id").autocomplete().data("uiAutocomplete")._renderItem =  function( ul, item ) 
       {
         return $( "<li>" )
         .append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
         .appendTo( ul );
       };
like image 96
Anuja Patil Avatar answered Oct 26 '22 13:10

Anuja Patil