Dropdown modifcation


Would be possible to do a dropdown option visible after type any alphabet?
because while initialize, its showing all dropdown option.
Please help me out…!!!


Yes. Supply a custom matcher callback function that returns null unless the user has entered something in the input box.

The following code should do what you want:

function matchCustom(params, item) {
    // If there is no search text, don't display the item.
    if ($.trim(params.term) === '') {
      return null;
    } else {
      return item;

When the dropdown opens, Select2 calls the custom matcher callback once for each item (<option>) in the Select2. Returning null from this callback causes Select2 not to display that item, whereas returning item causes Select2 to display that item.