It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
TAGS
Community showcase
Published in Teamwork

Listening out loud: how Dave Liao works on distributed teams

The start of the COVID-19 pandemic served as a forcing function to re-evaluate the way teams worked together. In fact, many companies are re-learning how to collaborate with their teams. As some move...

122 views 4 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you