Reputation: 114437
I am using this tagging plug-in: http://xoxco.com/projects/code/tagsinput/
One thing that is not covered in the docs is how to get currently typed-in value. I need this in order to build the querystring for a custom autocompleter.
$('#tags').tagsInput({
autocomplete_url:'http://myserver.com/api/autocomplete?term='(??????),
autocomplete:{selectFirst:true,width:'100px',autoFill:true}
});
Upvotes: 1
Views: 119
Reputation: 114437
Instead of looking at the tagging plug-in for the solution I decided to look at the Autocompleter itself and extract the value from there.
var tags = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ];
$( "#autocomplete" ).autocomplete({
source: function( request, response ) {
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
response( $.grep( tags, function( item ){
return matcher.test( item );
}) );
}
});
From here I noticed the request.term
variable, which I could then grab for my own Ajax call parameter.
Upvotes: 1