Reputation: 1693
I have a form input with which I am using select2 to use tag/dropdown menu. It has an id of tag_list and use this jquery:
$('#tag_list').select2({
placeholder: 'a short description of what this content explains',
tags: true
});
Right now what happens is when the user clicks on the input box, which causes a cursor to appear at the beginning of the box, a dropdown menu appears with all of the created tags. The user can type and the dropdown will filter results based on what the user types, or the user can create a new tag.
I want to know: can I make it so that the dropdown menu appears only after at least one (or n) letters have been typed?
Upvotes: 2
Views: 3094
Reputation: 2180
you can do it by passing minimumInputLength with number you want.
$('#tag_list').select2({
placeholder: 'a short description of what this content explains',
minimumInputLength: 2,
tags: true
});
checkout example here.
http://select2.github.io/select2/
Upvotes: 1