Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Autocomplete

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2013

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

0 votes
Shubham Garg June 26, 2016

Hey,

I am facing the same problem

Were you able to find any solution for this?

0 votes
JulianA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2013

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

0 votes
JulianA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2013

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

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2013

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events