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" />
Hey,
I am facing the same problem
Were you able to find any solution for this?
Have you something like firebug for firefox? Maybe you can get there any information about the error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try to replace all '$' with 'AJS.$'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.