Skip to content

Instantly share code, notes, and snippets.

@danpastori
Created October 28, 2014 23:50
Show Gist options
  • Save danpastori/911efb301fe6c7a70fd8 to your computer and use it in GitHub Desktop.
Save danpastori/911efb301fe6c7a70fd8 to your computer and use it in GitHub Desktop.
Tags input with autocomplete functionality
$(document).ready(function(){
$('#tags-example').tagsInput({
autocomplete_url: function(request, response) {
var search_data = {
tags_example_search_param: $('#tags-example_tag').val()
}
var url = '/tags_example_autocomplete';
$.post(url, search_data, function(data){
response(data);
});
},autocomplete:{
selectFirst: true,
width: '100px',
select: function( event, ui ){
//Access additional key value pairs for the selected ui object
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment