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

This widget could not be displayed.

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.

This widget could not be displayed.

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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

147 views 16 7
Join discussion

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