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

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 );
       };


The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   const already declared in ES6 switch block [duplicate]

Similar Posts