Hi,
I have a text field which is autocomplete enabled using JS and my code looks as follows:
jQuery( function() {
jQuery('<input field>').autocomplete({
source: function( request, response ) {
jQuery.ajax( {
url: "<REST Path for getting the projects>",
dataType: "json",
data: {
"query" : request.term
},
success: function (data) {
response( jQuery.map( data.projects, function ( item ) {
return {
label: item.name+' ('+item.key+')' ,
value : item.name
};
}));
}
});
},
select: function( event, ui ) {
jQuery('<input field>'').val(ui.item.value);
}
} );
} );
As is obvious, I am trying to autocomplete and list down the projects and print it in "Project name (Project key)" format.
I am getting the following error: "Uncaught TypeError: jQuery(...).autocomplete is not a function".
Pls suggest. Thank you.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.