In rails 4.0, I am trying to implement tags input field using jquery tagit() plugin. In this plugin, user should select the input tags from autocompletion list not by custom entry. Here how can I avoid the custom entry? And also here, I mentioned minLength as 2 but the autocompletion list is showing when I type the first letter itself.
For code reference I used https://github.com/aehlke/tag-it
Code is,
jQuery(document).ready(function() {
jQuery("#DIV_USERNAME").tagit({
minLength: 2,
tagLimit: 3,
allowNewTags: false,
placeholderText: "You can enter only 3 tags",
tagSource: function( request, response ) {
$.ajax({
url: "autocomplete/names",
data: { term:request.term },
dataType: "json",
success: function( data ) {
response( $.map( data, function( item ) {
return {
label: item.value
}
}));
}
});
}
});
});
If i mentioned allowNewTags: false also it is not working.