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

.js

$(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" )
      .autocomplete({
        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
          terms.pop();
          // 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

Hey,

I am facing the same problem

Were you able to find any solution for this?

Suggest an answer

Log in or Sign up to answer
Community showcase

Scrum Roles Explained: the Do's and the Don'ts

Hello Community,  Today we are going to talk about the three Scrum Roles. There is the Development Team, the Scrum Master and the Product Owner. In my opinion these three are all really impo...

63 views 0 4
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