Hi All,

I am writing a plugin in which I stuck with autocomplete task.

I am able to execute jquery in jsfiddle but now working in my .vm


$(function() {
    var items = [ 'France', 'Italy', 'Malta', 'England', 
        'Australia', 'Spain', 'Scotland' ];
    function split( val ) {
      return val.split( /,\s*/ ); 
    function extractLast( term ) {
      return split( term ).pop();
    $( "#search" )
        minLength: 0,
        source: function( request, response ) {
          response( $.ui.autocomplete.filter(
            items, extractLast( request.term ) ) );
        focus: function() {
          return false;
        select: function( event, ui ) {
          var terms = split( this.value );
          // remove the current input
          // add the selected item
          terms.push( ui.item.value );
          // add placeholder to get the comma-and-space at the end
          terms.push( "" );
          this.value = terms.join( ", " );
          return false;

.vm file

<input id="search" />

3 answers

try to replace all '$' with 'AJS.$'

response( AJS.$.ui.autocomplete.items, extractLast( request.term ) ) );

I replaced $ to AJS.$ but same error , when I replace AJS.$ to this. it

doesn't threws any exception but autocomplete not works.

Have you something like firebug for firefox? Maybe you can get there any information about the error


I am facing the same problem

Were you able to find any solution for this?

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

47 views 1 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot